Make the callback type the first argument to Waitable!().

This commit is contained in:
Sönke Ludwig 2017-01-16 00:23:37 +01:00
parent 964d72f3b5
commit 9d4e8086ff
3 changed files with 20 additions and 27 deletions

View file

@ -1091,10 +1091,9 @@ private struct ThreadLocalWaiter {
target_timeout = now + timeout;
}
Waitable!(
Waitable!(typeof(Waiter.notifier),
cb => w.wait(cb),
cb => w.cancel(),
typeof(Waiter.notifier)
) waitable;
void removeWaiter()
@ -1114,7 +1113,7 @@ private struct ThreadLocalWaiter {
scope (failure) removeWaiter();
if (evt != EventID.invalid) {
Waitable!(
Waitable!(EventCallback,
(cb) {
eventDriver.events.wait(evt, cb);
// check for exit codition *after* starting to wait for the event
@ -1124,8 +1123,7 @@ private struct ThreadLocalWaiter {
cb(evt);
}
},
cb => eventDriver.events.cancelWait(evt, cb),
EventCallback
cb => eventDriver.events.cancelWait(evt, cb)
) ewaitable;
asyncAwaitAny!interruptible(timeout, waitable, ewaitable);
} else {