mirror of
https://github.com/fluencelabs/redis
synced 2025-03-17 08:00:49 +00:00
Mask SIGALRM everything but in the main thread.
This is required to ensure that the signal will be delivered to the main thread when the watchdog timer expires.
This commit is contained in:
parent
a354da9acd
commit
aa96122d96
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user