diff options
author | B Stack <bgstack15@gmail.com> | 2020-07-22 11:37:03 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2020-07-22 11:37:03 -0400 |
commit | c95b3937fef3e2c63768f1b3b1dc2c898f23d91d (patch) | |
tree | 10260e25ae905564f7978b83fc4e316670f987c6 /wx+/async_task.h | |
parent | Merge branch '10.25' into 'master' (diff) | |
download | FreeFileSync-c95b3937fef3e2c63768f1b3b1dc2c898f23d91d.tar.gz FreeFileSync-c95b3937fef3e2c63768f1b3b1dc2c898f23d91d.tar.bz2 FreeFileSync-c95b3937fef3e2c63768f1b3b1dc2c898f23d91d.zip |
add upstream 11.0
Diffstat (limited to 'wx+/async_task.h')
-rw-r--r-- | wx+/async_task.h | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/wx+/async_task.h b/wx+/async_task.h index 1599c4d7..47660a6a 100644 --- a/wx+/async_task.h +++ b/wx+/async_task.h @@ -16,18 +16,16 @@ namespace zen { -/* -Run a task in an async thread, but process result in GUI event loop -------------------------------------------------------------------- -1. put AsyncGuiQueue instance inside a dialog: - AsyncGuiQueue guiQueue; +/* Run a task in an async thread, but process result in GUI event loop + ------------------------------------------------------------------- + 1. put AsyncGuiQueue instance inside a dialog: + AsyncGuiQueue guiQueue; -2. schedule async task and synchronous continuation: - guiQueue.processAsync(evalAsync, evalOnGui); + 2. schedule async task and synchronous continuation: + guiQueue.processAsync(evalAsync, evalOnGui); -Alternative: use wxWidgets' inter-thread communication (wxEvtHandler::QueueEvent) https://wiki.wxwidgets.org/Inter-Thread_and_Inter-Process_communication - => don't bother, probably too many MT race conditions lurking around -*/ + Alternative: wxWidgets' inter-thread communication (wxEvtHandler::QueueEvent) https://wiki.wxwidgets.org/Inter-Thread_and_Inter-Process_communication + => don't bother, probably too many MT race conditions lurking around */ namespace impl { @@ -44,7 +42,8 @@ class ConcreteTask : public Task { public: template <class Fun2> - ConcreteTask(std::future<ResultType>&& asyncResult, Fun2&& evalOnGui) : asyncResult_(std::move(asyncResult)), evalOnGui_(std::forward<Fun2>(evalOnGui)) {} + ConcreteTask(std::future<ResultType>&& asyncResult, Fun2&& evalOnGui) : + asyncResult_(std::move(asyncResult)), evalOnGui_(std::forward<Fun2>(evalOnGui)) {} bool resultReady () const override { return isReady(asyncResult_); } void evaluateResult() override |