aboutsummaryrefslogtreecommitdiff
path: root/include/salticidae/event.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/salticidae/event.h')
-rw-r--r--include/salticidae/event.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/include/salticidae/event.h b/include/salticidae/event.h
index 78ae12d..30d8f3c 100644
--- a/include/salticidae/event.h
+++ b/include/salticidae/event.h
@@ -671,6 +671,7 @@ class ThreadCall {
friend ThreadCall;
public:
Handle(): notifier(nullptr) {}
+ Handle(const Handle &) = delete;
void exec() {
callback(*this);
if (notifier)
@@ -707,16 +708,16 @@ class ThreadCall {
}
template<typename Func>
- void async_call(Func callback) {
+ void async_call(Func &&callback) {
auto h = new Handle();
- h->callback = callback;
+ h->callback = std::forward<Func>(callback);
q.enqueue(h);
}
template<typename Func>
- Result call(Func callback) {
+ Result call(Func &&callback) {
auto h = new Handle();
- h->callback = callback;
+ h->callback = std::forward<Func>(callback);
ThreadNotifier<Result> notifier;
h->notifier = &notifier;
q.enqueue(h);