summaryrefslogtreecommitdiff
path: root/wx+/async_task.h
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2019-02-10 16:47:23 -0500
committerB Stack <bgstack15@gmail.com>2019-02-10 16:47:23 -0500
commita48439992d4b1c896dd0beaff91d0a14361032b9 (patch)
tree475a67b0b138f2b1cd5f02eaab8e413f7eee62c6 /wx+/async_task.h
parentMerge branch '10.8' into 'master' (diff)
downloadFreeFileSync-a48439992d4b1c896dd0beaff91d0a14361032b9.tar.gz
FreeFileSync-a48439992d4b1c896dd0beaff91d0a14361032b9.tar.bz2
FreeFileSync-a48439992d4b1c896dd0beaff91d0a14361032b9.zip
10.9
Diffstat (limited to 'wx+/async_task.h')
-rw-r--r--[-rwxr-xr-x]wx+/async_task.h5
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!
};
bgstack15