Skip to content

Commit 2223f9f

Browse files
committed
Refactoring
1 parent 1f9196a commit 2223f9f

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

threadpool.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,16 @@ void ThreadPool::init_mutex(pthread_mutex_t* const mutex)
178178
void ThreadPool::init_sem(sem_t* const sem)
179179
{
180180
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-
}
181+
182+
if (0 == ret) return;
183+
184+
switch (errno) {
185+
case EINVAL:
186+
throw Error("EINVAL returned by sem_init()");
187+
case ENOSYS:
188+
throw Error("ENOSYS returned by sem_init()");
189+
default:
190+
throw Error("UNKNOWN returned by sem_init()");
190191
}
191192
}
192193

0 commit comments

Comments
 (0)