… | |
… | |
47 | } |
47 | } |
48 | } |
48 | } |
49 | |
49 | |
50 | sub select(;*$$$) { # not the correct prototype, but well... :() |
50 | sub select(;*$$$) { # not the correct prototype, but well... :() |
51 | if (@_ == 0) { |
51 | if (@_ == 0) { |
52 | return CORE::select; |
52 | return CORE::select |
53 | } elsif (@_ == 1) { |
53 | } elsif (@_ == 1) { |
54 | return CORE::select $_[0]; |
54 | return CORE::select $_[0] |
55 | } elsif (defined $_[3] && !$_[3]) { |
55 | } elsif (defined $_[3] && !$_[3]) { |
56 | return &CORE::select (@_); |
56 | return CORE::select $_[0], $_[1], $_[2], $_[3] |
57 | } else { |
57 | } else { |
58 | my $current = $Coro::current; |
58 | my $current = $Coro::current; |
59 | my $nfound = 0; |
59 | my $nfound = 0; |
60 | my @w; |
60 | my @w; |
61 | for ([0, 'r'], [1, 'w'], [2, 'e']) { |
61 | for ([0, 'r'], [1, 'w'], [2, 'e']) { |
… | |
… | |
83 | |
83 | |
84 | Coro::schedule; |
84 | Coro::schedule; |
85 | # wait here |
85 | # wait here |
86 | |
86 | |
87 | $_->cancel for @w; |
87 | $_->cancel for @w; |
88 | return $nfound; |
88 | return $nfound |
89 | } |
89 | } |
90 | } |
90 | } |
91 | |
91 | |
92 | 1; |
92 | 1; |
93 | |
93 | |