Skip to content

Commit

Permalink
doc: explain how the threadpool is allocated
Browse files Browse the repository at this point in the history
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: #145

PR-URL: #146
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
almosnow authored and bnoordhuis committed Jan 21, 2015
1 parent 32747c7 commit ea5f1f9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/src/threadpool.rst
Expand Up @@ -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
Expand Down

0 comments on commit ea5f1f9

Please sign in to comment.