summaryrefslogtreecommitdiffstats
path: root/player/screenshot.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-05-06 16:17:47 +0200
committerwm4 <wm4@nowhere>2018-05-24 19:56:34 +0200
commita1ed1f8be09c927994b58399e77e99336ec7f436 (patch)
tree8989650d9c899dcd140223e10f15a756ad9f0c7f /player/screenshot.c
parenta0308d31697c5dd601ee036acbc937c361746cc3 (diff)
downloadmpv-a1ed1f8be09c927994b58399e77e99336ec7f436.tar.bz2
mpv-a1ed1f8be09c927994b58399e77e99336ec7f436.tar.xz
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.
Diffstat (limited to 'player/screenshot.c')
-rw-r--r--player/screenshot.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/player/screenshot.c b/player/screenshot.c
index d0e5777a65..6b5e50ced3 100644
--- a/player/screenshot.c
+++ b/player/screenshot.c
@@ -148,7 +148,7 @@ static void write_screenshot(struct MPContext *mpctx, struct mp_image *img,
if (async) {
if (!ctx->thread_pool)
- ctx->thread_pool = mp_thread_pool_create(ctx, 1);
+ ctx->thread_pool = mp_thread_pool_create(ctx, 1, 1, 3);
if (ctx->thread_pool) {
item->on_thread = true;
mpctx->outstanding_async += 1;