We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ccee157 commit 2497e20Copy full SHA for 2497e20
threading.c
@@ -78,22 +78,22 @@ int semaphore_init(
78
*semaphore = CreateSemaphore(NULL, value, 65535, NULL);
79
if (*semaphore == NULL)
80
return GetLastError();
81
- else
82
- return 0;
83
#else
84
// Mac OS X doesn't support unnamed semaphores via sem_init, that's why
85
// we use sem_open instead sem_init and immediately unlink the semaphore
86
// from the name. More info at:
87
//
88
// http://stackoverflow.com/questions/1413785/sem-init-on-os-x
89
*semaphore = sem_open("/semaphore", O_CREAT, S_IRUSR, value);
+
90
if (*semaphore == SEM_FAILED)
91
return errno;
92
93
94
if (sem_unlink("/semaphore") != 0)
95
96
#endif
+ return 0;
97
}
98
99
0 commit comments