Merge pull request #661 from dbabokin/task_diagnostics
Fix task system dignostic to report real reason of the symaphore allocat...
This commit is contained in:
@@ -693,10 +693,20 @@ InitTaskSystem() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char name[32];
|
char name[32];
|
||||||
sprintf(name, "ispc_task.%d", (int)getpid());
|
bool success = false;
|
||||||
workerSemaphore = sem_open(name, O_CREAT, S_IRUSR|S_IWUSR, 0);
|
srand(time(NULL));
|
||||||
if (!workerSemaphore) {
|
for (int i = 0; i < 10; i++) {
|
||||||
fprintf(stderr, "Error creating semaphore: %s\n", strerror(err));
|
sprintf(name, "ispc_task.%d.%d", (int)getpid(), (int)rand());
|
||||||
|
workerSemaphore = sem_open(name, O_CREAT, S_IRUSR|S_IWUSR, 0);
|
||||||
|
if (workerSemaphore != SEM_FAILED) {
|
||||||
|
success = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fprintf(stderr, "Failed to create %s\n", name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!success) {
|
||||||
|
fprintf(stderr, "Error creating semaphore (%s): %s\n", name, strerror(errno));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user