static void pthreadpool_child(void) { int ret; struct pthreadpool *pool; for (pool = DLIST_TAIL(pthreadpools); pool != NULL; pool = DLIST_PREV(pool)) { close(pool->sig_pipe[0]); close(pool->sig_pipe[1]); ret = pipe(pool->sig_pipe); assert(ret == 0); pool->num_threads = 0; pool->num_exited = 0; free(pool->exited); pool->exited = NULL; pool->num_idle = 0; pool->head = 0; pool->num_jobs = 0; ret = pthread_mutex_unlock(&pool->mutex); assert(ret == 0); } ret = pthread_mutex_unlock(&pthreadpools_mutex); assert(ret == 0); }
static void pthreadpool_parent(void) { int ret; struct pthreadpool *pool; for (pool = DLIST_TAIL(pthreadpools); pool != NULL; pool = DLIST_PREV(pool)) { ret = pthread_mutex_unlock(&pool->mutex); assert(ret == 0); } ret = pthread_mutex_unlock(&pthreadpools_mutex); assert(ret == 0); }
static void pthreadpool_child(void) { int ret; struct pthreadpool *pool; pool = DLIST_TAIL(pthreadpools); while (1) { close(pool->sig_pipe[0]); close(pool->sig_pipe[1]); ret = pipe(pool->sig_pipe); assert(ret == 0); pool->num_threads = 0; pool->num_exited = 0; free(pool->exited); pool->exited = NULL; pool->num_idle = 0; while (pool->jobs != NULL) { struct pthreadpool_job *job; job = pool->jobs; pool->jobs = job->next; free(job); } pool->last_job = NULL; ret = pthread_mutex_unlock(&pool->mutex); assert(ret == 0); if (pool == pthreadpools) { break; } pool = pool->prev; } ret = pthread_mutex_unlock(&pthreadpools_mutex); assert(ret == 0); }
static void pthreadpool_parent(void) { int ret; struct pthreadpool *pool; pool = DLIST_TAIL(pthreadpools); while (1) { ret = pthread_mutex_unlock(&pool->mutex); assert(ret == 0); if (pool == pthreadpools) { break; } pool = pool->prev; } ret = pthread_mutex_unlock(&pthreadpools_mutex); assert(ret == 0); }