From 1569d02aa38baa53d5442b3babdbf1a3aaa3aaa0 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 19 Oct 2020 14:44:55 +0200 Subject: Load thumbnails with multiple threads, use sha256 for saving image to path instead of base64 (filename limit is 256 on linux...) --- src/QuickMedia.cpp | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'src/QuickMedia.cpp') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 54af0fa..659e59c 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -380,16 +380,6 @@ namespace QuickMedia { } Program::~Program() { - if(upscale_image_action != UpscaleImageAction::NO && running) { - running = false; - { - std::unique_lock lock(image_upscale_mutex); - image_upscale_cv.notify_one(); - } - image_upscale_thead.join(); - } else { - running = false; - } if(matrix) delete matrix; if(disp) @@ -506,15 +496,12 @@ namespace QuickMedia { return -2; } - running = true; image_upscale_thead = std::thread([this]{ CopyOp copy_op; - while(running) { + while(true) { { std::unique_lock lock(image_upscale_mutex); - while(images_to_upscale.empty() && running) image_upscale_cv.wait(lock); - if(!running) - break; + while(images_to_upscale.empty()) image_upscale_cv.wait(lock); copy_op = images_to_upscale.front(); images_to_upscale.pop_front(); } @@ -539,8 +526,7 @@ namespace QuickMedia { file_overwrite(copy_op.destination.data.c_str(), "1"); } }); - } else { - running = true; + image_upscale_thead.detach(); } if(strcmp(plugin_name, "file-manager") != 0 && start_dir) { -- cgit v1.2.3