Permalink
Browse files

Return value of condvar's recv should be an item.

Types and contexts of received values can be vary. To keep it
simple and flexible, it should be an Any scalar or Parcel.
  • Loading branch information...
am0c committed Oct 30, 2012
1 parent f491b73 commit 19d57b598b82ce8641eb1ac5685c3171f34732d6
Showing with 4 additions and 5 deletions.
  1. +4 −5 lib/MuEvent.pm
View
@@ -8,19 +8,18 @@ my $since;
class MuEvent::Condvar {
has &.cb;
- has @.sent is rw;
+ has $.sent is rw;
has $.flag is rw = False;
- method send(*@data) {
+ method send($data?) {
&.cb() if &.cb;
- @.sent = @data if @data;
+ $.sent = $data if $data.defined;
$.flag = True;
}
method recv() {
$since = clock() unless $since.defined;
MuEvent::_poll until $.flag;
- return unless @.sent;
- return @.sent > 1 ?? @.sent !! @.sent[0];
+ $.sent;
}
}

0 comments on commit 19d57b5

Please sign in to comment.