We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1f9196a commit 2223f9fCopy full SHA for 2223f9f
1 file changed
threadpool.cpp
@@ -178,15 +178,16 @@ void ThreadPool::init_mutex(pthread_mutex_t* const mutex)
178
void ThreadPool::init_sem(sem_t* const sem)
179
{
180
int ret = sem_init(sem, 0, 0);
181
- if (0 != ret) {
182
- switch (errno) {
183
- case EINVAL:
184
- throw Error("EINVAL returned by sem_init()");
185
- case ENOSYS:
186
- throw Error("ENOSYS returned by sem_init()");
187
- default:
188
- throw Error("UNKNOWN returned by sem_init()");
189
- }
+
+ if (0 == ret) return;
+ switch (errno) {
+ case EINVAL:
+ throw Error("EINVAL returned by sem_init()");
+ case ENOSYS:
+ throw Error("ENOSYS returned by sem_init()");
+ default:
190
+ throw Error("UNKNOWN returned by sem_init()");
191
}
192
193
0 commit comments