diff --git a/include/threadpool.h b/include/threadpool.h index 7f6c9e9..4b0a70d 100644 --- a/include/threadpool.h +++ b/include/threadpool.h @@ -50,7 +50,7 @@ ANN static inline int gwt_signal(gwtcond_t *cond) { } ANN static inline int gwt_create(gwtthread_t *thread, gwtreturn_t (*fun)(void*), void *arg) { *thread = CreateThread(NULL, 0, fun, arg, 0, NULL); - return 0; + return !!*thread; } ANN static inline void gwt_join(gwtthread_t thread) { WaitForSingleObject(thread, INFINITE); // dword // (DWORD)0xFFFFFFFF on error @@ -102,7 +102,7 @@ ANN static inline void gwt_cond_end(gwtcond_t *cond) { pthread_cond_destroy(cond); // int } ANN static inline bool gwt_create(gwtthread_t *thread, gwtreturn_t (*fun)(void*), void *arg) { - return !pthread_create(thread, NULL, fun, arg); // int + return pthread_create(thread, NULL, fun, arg); // int } #endif diff --git a/src/threadpool.c b/src/threadpool.c index 261297e..670a1e5 100644 --- a/src/threadpool.c +++ b/src/threadpool.c @@ -56,8 +56,8 @@ ANN static bool utils(threadpool_t *p) { ANN static bool start(threadpool_t *p, const uint32_t thread_count) { for(uint32_t i = 0; i < thread_count; i++) { - if(!gwt_create(&p->threads[i], threadpool_thread, p)) - return false; + const int ret = gwt_create(&p->threads[i], threadpool_thread, p); + if(ret) return false; p->started++; } return true; @@ -75,7 +75,6 @@ threadpool_t *new_threadpool(const uint32_t thread_count, const uint32_t queue_s free_threadpool(p); return NULL; } - return p; }