diff options
author | Alex Mo <almosnow@gmail.com> | 2015-01-19 17:58:29 -0600 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2015-01-21 01:16:04 +0100 |
commit | ea5f1f98e0043d6f8deb9edeb0525a19adcf3429 (patch) | |
tree | 777eea8ca99ce508522a5ff9b0f36ace2c53a6c5 /docs/src | |
parent | 32747c75cea25a2f4c59ae25e7a1285f810ae001 (diff) | |
download | libuv-ea5f1f98e0043d6f8deb9edeb0525a19adcf3429.tar.gz libuv-ea5f1f98e0043d6f8deb9edeb0525a19adcf3429.zip |
doc: explain how the threadpool is allocated
Add an explanation about how libuv implements the threadpool and why.
This is so users know what behavior they should expect when they make
use of threads.
Related issue: https://github.com/libuv/libuv/issues/145
PR-URL: https://github.com/libuv/libuv/pull/146
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'docs/src')
-rw-r--r-- | docs/src/threadpool.rst | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/docs/src/threadpool.rst b/docs/src/threadpool.rst index 66ff53e2..89f00844 100644 --- a/docs/src/threadpool.rst +++ b/docs/src/threadpool.rst @@ -12,7 +12,11 @@ Its default size is 4, but it can be changed at startup time by setting the ``UV_THREADPOOL_SIZE`` environment variable to any value (the absolute maximum is 128). -The threadpool is global and shared across all event loops. +The threadpool is global and shared across all event loops. When a particular +function makes use of the threadpool (i.e. when using :c:func:`uv_queue_work`) +libuv preallocates and initializes the maximum number of threads allowed by +``UV_THREADPOOL_SIZE``. This causes a relatively minor memory overhead +(~1MB for 128 threads) but increases the performance of threading at runtime. Data types |