bio: doFastMemoryTest should try to kill io threads as well.

(cherry picked from commit f86602339968cc89e31bd51fb9d6c771c3ab26ee)
This commit is contained in:
WuYunlong 2020-09-16 09:58:24 +08:00 committed by Oran Agra
parent 5d9332266d
commit ea4bf91abc
3 changed files with 19 additions and 0 deletions

View File

@ -1530,6 +1530,7 @@ static void killMainThread(void) {
static void killThreads(void) { static void killThreads(void) {
killMainThread(); killMainThread();
bioKillThreads(); bioKillThreads();
killIOThreads();
} }
/* Scans the (assumed) x86 code starting at addr, for a max of `len` /* Scans the (assumed) x86 code starting at addr, for a max of `len`

View File

@ -3021,6 +3021,23 @@ void initThreadedIO(void) {
} }
} }
void killIOThreads(void) {
int err, j;
for (j = 0; j < server.io_threads_num; j++) {
if (io_threads[j] == pthread_self()) continue;
if (io_threads[j] && pthread_cancel(io_threads[j]) == 0) {
if ((err = pthread_join(io_threads[j],NULL)) != 0) {
serverLog(LL_WARNING,
"IO thread(tid:%lu) can not be joined: %s",
(unsigned long)io_threads[j], strerror(err));
} else {
serverLog(LL_WARNING,
"IO thread(tid:%lu) terminated",(unsigned long)io_threads[j]);
}
}
}
}
void startThreadedIO(void) { void startThreadedIO(void) {
if (tio_debug) { printf("S"); fflush(stdout); } if (tio_debug) { printf("S"); fflush(stdout); }
if (tio_debug) printf("--- STARTING THREADED IO ---\n"); if (tio_debug) printf("--- STARTING THREADED IO ---\n");

View File

@ -2460,6 +2460,7 @@ int memtest_preserving_test(unsigned long *m, size_t bytes, int passes);
void mixDigest(unsigned char *digest, void *ptr, size_t len); void mixDigest(unsigned char *digest, void *ptr, size_t len);
void xorDigest(unsigned char *digest, void *ptr, size_t len); void xorDigest(unsigned char *digest, void *ptr, size_t len);
int populateCommandTableParseFlags(struct redisCommand *c, char *strflags); int populateCommandTableParseFlags(struct redisCommand *c, char *strflags);
void killIOThreads(void);
/* TLS stuff */ /* TLS stuff */
void tlsInit(void); void tlsInit(void);