aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_thread_pool.c
diff options
context:
space:
mode:
authorPiotr Sikora <piotrsikora@google.com>2016-08-15 05:52:04 -0700
committerPiotr Sikora <piotrsikora@google.com>2016-08-15 05:52:04 -0700
commit14b1b6e10a75994a6001a3480901e62f43e05696 (patch)
treed84b305fbfc330e640125d0927a323a4ded6b78c /src/core/ngx_thread_pool.c
parent78031177f41a8686f0402b3ec7240870bca314af (diff)
downloadnginx-14b1b6e10a75994a6001a3480901e62f43e05696.tar.gz
nginx-14b1b6e10a75994a6001a3480901e62f43e05696.zip
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 <piotrsikora@google.com>
Diffstat (limited to 'src/core/ngx_thread_pool.c')
-rw-r--r--src/core/ngx_thread_pool.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/ngx_thread_pool.c b/src/core/ngx_thread_pool.c
index f3655aa0b..7fb0f7f8d 100644
--- 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 *tp, ngx_log_t *log, ngx_pool_t *pool)
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) {