# HG changeset patch # User Piotr Sikora # Date 1471265524 25200 # Node ID 33d075b9097da7f8df0d7b644b3322e5575975cd # Parent 3f82c1e7e29e6ff2f8523a338a4f3d5a070b678c Thread pools: create threads in detached state. This prevents theoretical resource leak, since those threads are never joined. Found with ThreadSanitizer. Signed-off-by: Piotr Sikora diff --git a/src/core/ngx_thread_pool.c b/src/core/ngx_thread_pool.c --- a/src/core/ngx_thread_pool.c +++ b/src/core/ngx_thread_pool.c @@ -137,6 +137,13 @@ ngx_thread_pool_init(ngx_thread_pool_t * return NGX_ERROR; } + err = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + if (err) { + ngx_log_error(NGX_LOG_ALERT, log, err, + "pthread_attr_setdetachstate() failed"); + return NGX_ERROR; + } + #if 0 err = pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN); if (err) {