fix deadlock

This commit is contained in:
lxsang 2018-10-14 11:25:13 +02:00
parent ee5c630052
commit 64e912ab6e
2 changed files with 3 additions and 1 deletions

View File

@ -34,6 +34,8 @@ static void stop(antd_scheduler_t* scheduler)
pthread_mutex_destroy(&scheduler->scheduler_lock);
pthread_mutex_destroy(&scheduler->worker_lock);
pthread_mutex_destroy(&scheduler->pending_lock);
sem_unlink("scheduler");
sem_unlink("worker");
sem_close(scheduler->scheduler_sem);
sem_close(scheduler->worker_sem);
}

View File

@ -4,7 +4,7 @@
#include "utils.h"
#include <pthread.h>
#include <semaphore.h>
#include <fcntl.h>
#define N_PRIORITY 10
#define NORMAL_PRIORITY ((int)((N_PRIORITY - 1) / 2))
#define LOW_PRIORITY (N_PRIORITY - 1)