mirror of
https://github.com/mpv-player/mpv
synced 2024-11-03 03:19:24 +01:00
a1ed1f8be0
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.
13 lines
371 B
C
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
|