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. */
| 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. */ |
| 294 | void 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 | } |
no test coverage detected