aboutsummaryrefslogtreecommitdiff
path: root/include/salticidae/event.h
diff options
context:
space:
mode:
authorDeterminant <ted.sybil@gmail.com>2019-07-01 02:40:45 -0400
committerDeterminant <ted.sybil@gmail.com>2019-07-01 02:40:45 -0400
commit19082449b9cc5f8004a9591af8e493c069671396 (patch)
tree31fb62acfe10fd650aa8e6efd25692b6b210253d /include/salticidae/event.h
parent8bcaadaa42e2c91230faf850d10c29703578ef7b (diff)
better peer teardown
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);