1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-28 10:02:17 +00:00
mpv/misc/thread_pool.h
wm4 a1ed1f8be0 thread_pool: make it slightly less dumb
The existing thread pool code is the most primitive thread pool
possible. That's fine, but one annoying thing was that it used a static
number of threads. Make it dynamic, so we don't need to "waste" idle
threads.

This tries to add threads as needed. If threads are idle for some time,
destroy them again until a minimum number of threads is reached.

Also change the license to ISC.
2018-05-24 19:56:34 +02:00

13 lines
371 B
C

#ifndef MPV_MP_THREAD_POOL_H
#define MPV_MP_THREAD_POOL_H
struct mp_thread_pool;
struct mp_thread_pool *mp_thread_pool_create(void *ta_parent, int init_threads,
int min_threads, int max_threads);
bool mp_thread_pool_queue(struct mp_thread_pool *pool, void (*fn)(void *ctx),
void *fn_ctx);
#endif