ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Coro/Semaphore.pm
(Generate patch)

Comparing Coro/Coro/Semaphore.pm (file contents):
Revision 1.26 by root, Tue Nov 27 04:42:53 2001 UTC vs.
Revision 1.27 by root, Mon Dec 3 05:52:36 2001 UTC

35 35
36no warnings qw(uninitialized); 36no warnings qw(uninitialized);
37 37
38use Coro (); 38use Coro ();
39 39
40$VERSION = 0.52; 40$VERSION = 0.53;
41 41
42=item new [inital count] 42=item new [inital count]
43 43
44Creates a new sempahore object with the given initial lock count. The 44Creates a new sempahore object with the given initial lock count. The
45default lock count is 1, which means it is unlocked by default. Zero (or 45default lock count is 1, which means it is unlocked by default. Zero (or
78 78
79 while ($_[0][0] <= 0) { 79 while ($_[0][0] <= 0) {
80 push @{$_[0][1]}, $Coro::current; 80 push @{$_[0][1]}, $Coro::current;
81 Coro::schedule; 81 Coro::schedule;
82 if ($timeout) { 82 if ($timeout) {
83 # ugly as hell. slow, too! 83 # ugly as hell. slow, too, btw!
84 for (0..$#{$_[0][1]}) { 84 for (0..$#{$_[0][1]}) {
85 if ($_[0][1][$_] == $Coro::current) { 85 if ($_[0][1][$_] == $Coro::current) {
86 splice @{$_[0][1]}, $_, 1; 86 splice @{$_[0][1]}, $_, 1;
87 return; 87 return;
88 } 88 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines