diff options
author | Daniel Wilhelm <shieldwed@outlook.com> | 2019-02-13 21:05:15 +0000 |
---|---|---|
committer | Daniel Wilhelm <shieldwed@outlook.com> | 2019-02-13 21:05:15 +0000 |
commit | 2e618740c10a6dc7f5a8ee031a196b4ac95b1294 (patch) | |
tree | 475a67b0b138f2b1cd5f02eaab8e413f7eee62c6 /wx+/async_task.h | |
parent | Merge branch '10.8' into 'master' (diff) | |
parent | 10.9 (diff) | |
download | FreeFileSync-10.9.tar.gz FreeFileSync-10.9.tar.bz2 FreeFileSync-10.9.zip |
Merge branch '10.9' into 'master'10.9
10.9
See merge request opensource-tracking/FreeFileSync!6
Diffstat (limited to 'wx+/async_task.h')
-rw-r--r--[-rwxr-xr-x] | wx+/async_task.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/wx+/async_task.h b/wx+/async_task.h index 074f5337..04eac61c 100755..100644 --- a/wx+/async_task.h +++ b/wx+/async_task.h @@ -115,7 +115,7 @@ private: class AsyncGuiQueue : private wxEvtHandler { public: - AsyncGuiQueue() { timer_.Connect(wxEVT_TIMER, wxEventHandler(AsyncGuiQueue::onTimerEvent), nullptr, this); } + AsyncGuiQueue(int pollingMs = 50) : pollingMs_(pollingMs) { timer_.Connect(wxEVT_TIMER, wxEventHandler(AsyncGuiQueue::onTimerEvent), nullptr, this); } template <class Fun, class Fun2> void processAsync(Fun&& evalAsync, Fun2&& evalOnGui) @@ -123,7 +123,7 @@ public: asyncTasks_.add(std::forward<Fun >(evalAsync), std::forward<Fun2>(evalOnGui)); if (!timer_.IsRunning()) - timer_.Start(50 /*unit: [ms]*/); + timer_.Start(pollingMs_ /*unit: [ms]*/); } private: @@ -134,6 +134,7 @@ private: timer_.Stop(); } + const int pollingMs_; impl::AsyncTasks asyncTasks_; wxTimer timer_; //don't use wxWidgets' idle handling => repeated idle requests/consumption hogs 100% cpu! }; |