X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/a60b397b6d2a25072c79fe0a5e29bea89a4d3786..a1b1c1ea3adb864c8c2e3feb4eaed890a9b505cf:/src/bio.c diff --git a/src/bio.c b/src/bio.c index a666f558..aa2cdf9f 100644 --- a/src/bio.c +++ b/src/bio.c @@ -108,9 +108,18 @@ void bioCreateBackgroundJob(int type, void *arg1, void *arg2, void *arg3) { void *bioProcessBackgroundJobs(void *arg) { struct bio_job *job; unsigned long type = (unsigned long) arg; + sigset_t sigset; pthread_detach(pthread_self()); pthread_mutex_lock(&bio_mutex[type]); + /* Block SIGALRM so we are sure that only the main thread will + * receive the watchdog signal. */ + sigemptyset(&sigset); + sigaddset(&sigset, SIGALRM); + if (pthread_sigmask(SIG_BLOCK, &sigset, NULL)) + redisLog(REDIS_WARNING, + "Warning: can't mask SIGALRM in bio.c thread: %s", strerror(errno)); + while(1) { listNode *ln; @@ -153,6 +162,11 @@ unsigned long long bioPendingJobsOfType(int type) { return val; } +#if 0 /* We don't use the following code for now, and bioWaitPendingJobsLE + probably needs a rewrite using conditional variables instead of the + current implementation. */ + + /* Wait until the number of pending jobs of the specified type are * less or equal to the specified number. * @@ -200,3 +214,4 @@ time_t bioOlderJobOfType(int type) { return time; } +#endif