diff options
author | wm4 <wm4@nowhere> | 2018-05-18 23:36:07 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2018-05-24 19:56:35 +0200 |
commit | f0cc6ba18df12f582c9777ab44fc98ebe9cb755e (patch) | |
tree | 96669d8df1da399de4855f6282a8b1d49200bd8b /misc | |
parent | 76dc5d9aa92f5c91c728004214f7b08c3a85a5f6 (diff) | |
download | mpv-f0cc6ba18df12f582c9777ab44fc98ebe9cb755e.tar.bz2 mpv-f0cc6ba18df12f582c9777ab44fc98ebe9cb755e.tar.xz |
thread_pool: move comments to .h file
Diffstat (limited to 'misc')
-rw-r--r-- | misc/thread_pool.c | 17 | ||||
-rw-r--r-- | misc/thread_pool.h | 17 |
2 files changed, 17 insertions, 17 deletions
diff --git a/misc/thread_pool.c b/misc/thread_pool.c index 766d72d87b..26c3861f1b 100644 --- a/misc/thread_pool.c +++ b/misc/thread_pool.c @@ -147,16 +147,6 @@ static void add_thread(struct mp_thread_pool *pool) MP_TARRAY_APPEND(pool, pool->threads, pool->num_threads, thread); } -// Create a thread pool with the given number of worker threads. This can return -// NULL if the worker threads could not be created. The thread pool can be -// destroyed with talloc_free(pool), or indirectly with talloc_free(ta_parent). -// If there are still work items on freeing, it will block until all work items -// are done, and the threads terminate. -// init_threads is the number of threads created in this function (and it fails -// if it could not be done). min_threads must be >=, if it's >, then the -// remaining threads will be created on demand, but never destroyed. -// If init_threads > 0, then mp_thread_pool_queue() can never fail. -// If init_threads == 0, mp_thread_pool_create() itself can never fail. struct mp_thread_pool *mp_thread_pool_create(void *ta_parent, int init_threads, int min_threads, int max_threads) { @@ -185,13 +175,6 @@ struct mp_thread_pool *mp_thread_pool_create(void *ta_parent, int init_threads, return pool; } -// Queue a function to be run on a worker thread: fn(fn_ctx) -// If no worker thread is currently available, it's appended to a list in memory -// with unbounded size. This function always returns immediately. -// Concurrent queue calls are allowed, as long as it does not overlap with -// pool destruction. -// This function is explicitly thread-safe. -// Cannot fail if thread pool was created with at least 1 thread. bool mp_thread_pool_queue(struct mp_thread_pool *pool, void (*fn)(void *ctx), void *fn_ctx) { diff --git a/misc/thread_pool.h b/misc/thread_pool.h index 7d5aed0531..4c15c0b5c5 100644 --- a/misc/thread_pool.h +++ b/misc/thread_pool.h @@ -3,9 +3,26 @@ struct mp_thread_pool; +// Create a thread pool with the given number of worker threads. This can return +// NULL if the worker threads could not be created. The thread pool can be +// destroyed with talloc_free(pool), or indirectly with talloc_free(ta_parent). +// If there are still work items on freeing, it will block until all work items +// are done, and the threads terminate. +// init_threads is the number of threads created in this function (and it fails +// if it could not be done). min_threads must be >=, if it's >, then the +// remaining threads will be created on demand, but never destroyed. +// If init_threads > 0, then mp_thread_pool_queue() can never fail. +// If init_threads == 0, mp_thread_pool_create() itself can never fail. struct mp_thread_pool *mp_thread_pool_create(void *ta_parent, int init_threads, int min_threads, int max_threads); +// Queue a function to be run on a worker thread: fn(fn_ctx) +// If no worker thread is currently available, it's appended to a list in memory +// with unbounded size. This function always returns immediately. +// Concurrent queue calls are allowed, as long as it does not overlap with +// pool destruction. +// This function is explicitly thread-safe. +// Cannot fail if thread pool was created with at least 1 thread. bool mp_thread_pool_queue(struct mp_thread_pool *pool, void (*fn)(void *ctx), void *fn_ctx); |