Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make bare await die (fixes #125257)
  • Loading branch information
lizmat committed May 28, 2015
1 parent 478994f commit d841d4e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/core/asyncops.pm
Expand Up @@ -4,15 +4,18 @@
# pool that blocks; for now, this cheat gets the basic idea in place.

proto sub await(|) { * }
multi sub await() {
die "Must specify a Promise or Channel to await on";
}
multi sub await(Promise:D $p) {
$p.result
}
multi sub await(*@awaitables) {
@awaitables.eager.map(&await)
}
multi sub await(Channel:D $c) {
$c.receive
}
multi sub await(*@awaitables) {
@awaitables.eager.map(&await)
}

sub cas (\val,&code) { val = code(val) } # naive implementation of cas

Expand Down

0 comments on commit d841d4e

Please sign in to comment.