diff options
author | wm4 <wm4@nowhere> | 2018-05-18 23:24:17 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2018-05-24 19:56:35 +0200 |
commit | 1ad027e8fd6df7fd3a96589c30b510568f264627 (patch) | |
tree | 4a263592b0a2aa188ae496a6ca62ac9292e57006 /misc/thread_pool.h | |
parent | f0cc6ba18df12f582c9777ab44fc98ebe9cb755e (diff) | |
download | mpv-1ad027e8fd6df7fd3a96589c30b510568f264627.tar.bz2 mpv-1ad027e8fd6df7fd3a96589c30b510568f264627.tar.xz |
thread_pool: add a helper function
The behavior of mp_thread_pool_queue() doesn't or shouldn't change, but
the new helper function requires touching its logic.
Diffstat (limited to 'misc/thread_pool.h')
-rw-r--r-- | misc/thread_pool.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/misc/thread_pool.h b/misc/thread_pool.h index 4c15c0b5c5..14954da58f 100644 --- a/misc/thread_pool.h +++ b/misc/thread_pool.h @@ -26,4 +26,9 @@ struct mp_thread_pool *mp_thread_pool_create(void *ta_parent, int init_threads, bool mp_thread_pool_queue(struct mp_thread_pool *pool, void (*fn)(void *ctx), void *fn_ctx); +// Like mp_thread_pool_queue(), but only queue the item and succeed if a thread +// can be reserved for the item (i.e. minimal wait time instead of unbounded). +bool mp_thread_pool_run(struct mp_thread_pool *pool, void (*fn)(void *ctx), + void *fn_ctx); + #endif |