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.57 by root, Wed Jul 25 14:30:48 2007 UTC vs.
Revision 1.73 by root, Thu Oct 30 09:57:01 2008 UTC

31 31
32=cut 32=cut
33 33
34package Coro::Semaphore; 34package Coro::Semaphore;
35 35
36BEGIN { eval { require warnings } && warnings->unimport ("uninitialized") } 36no warnings;
37 37
38use Coro (); 38use Coro ();
39 39
40$VERSION = 1.9; 40$VERSION = 4.802;
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
97 --$_[0][0]; 97 --$_[0][0];
98} 98}
99 99
100sub timed_down { 100sub timed_down {
101 require Coro::Timer; 101 require Coro::Timer;
102 my $timeout = Coro::Timer::timeout($_[1]); 102 my $timeout = Coro::Timer::timeout ($_[1]);
103 103
104 while ($_[0][0] <= 0) { 104 while ($_[0][0] <= 0) {
105 push @{$_[0][1]}, $Coro::current; 105 push @{$_[0][1]}, $Coro::current;
106 &Coro::schedule; 106 &Coro::schedule;
107 if ($timeout) { 107 if ($timeout) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines