await

Synchronously waits until the promise p is fulfilled. Can only be called in a fiber.

T
await
(
T
E
)
(
Promise!(T, E) p
)

Examples

import ae.net.asockets : socketManager;

auto one = resolve(1);
auto two = resolve(2);

int sum;
async(one.await + two.await).then((value) {
	sum = value;
});
socketManager.loop();
assert(sum == 3);

Meta