MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / bioKillThreads

Function bioKillThreads

src/bio.cpp:294–310  ·  view source on GitHub ↗

Kill the running bio threads in an unclean way. This function should be * used only when it's critical to stop the threads for some reason. * Currently Redis does this only on crash (for instance on SIGSEGV) in order * to perform a fast memory check without other threads messing with memory. */

Source from the content-addressed store, hash-verified

292 * Currently Redis does this only on crash (for instance on SIGSEGV) in order
293 * to perform a fast memory check without other threads messing with memory. */
294void bioKillThreads(void) {
295 int err, j;
296
297 for (j = 0; j < BIO_NUM_OPS; j++) {
298 if (bio_threads[j] == pthread_self()) continue;
299 if (bio_threads[j] && pthread_cancel(bio_threads[j]) == 0) {
300 if ((err = pthread_join(bio_threads[j],NULL)) != 0) {
301 serverLog(LL_WARNING,
302 "Bio thread for job type #%d can not be joined: %s",
303 j, strerror(err));
304 } else {
305 serverLog(LL_WARNING,
306 "Bio thread for job type #%d terminated",j);
307 }
308 }
309 }
310}

Callers 1

killThreadsFunction · 0.85

Calls 1

serverLogFunction · 0.85

Tested by

no test coverage detected