From a1ed1f8be09c927994b58399e77e99336ec7f436 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 6 May 2018 16:17:47 +0200 Subject: 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. --- player/screenshot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'player/screenshot.c') 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; -- cgit v1.2.3