fix deadlock

This commit is contained in:
lxsang 2018-10-14 11:02:27 +02:00
parent ba4bfadec0
commit 54bb040ef4

View File

@ -153,13 +153,13 @@ void antd_scheduler_init(antd_scheduler_t* scheduler, int n)
scheduler->workers_queue = NULL; scheduler->workers_queue = NULL;
scheduler->pending_task = 0 ; scheduler->pending_task = 0 ;
// init semaphore // init semaphore
scheduler->scheduler_sem = shm_open("scheduler", O_RDWR | O_CREAT, S_IRWXU); scheduler->scheduler_sem = sem_open("scheduler", O_RDWR | O_CREAT, S_IRWXU);
if (!scheduler->scheduler_sem) if (!scheduler->scheduler_sem)
{ {
LOG("Cannot open semaphore for scheduler\n"); LOG("Cannot open semaphore for scheduler\n");
exit(-1); exit(-1);
} }
scheduler->worker_sem = shm_open("worker", O_RDWR | O_CREAT, S_IRWXU); scheduler->worker_sem = sem_open("worker", O_RDWR | O_CREAT, S_IRWXU);
if (!scheduler->worker_sem) if (!scheduler->worker_sem)
{ {
LOG("Cannot open semaphore for workers\n"); LOG("Cannot open semaphore for workers\n");