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.4 by root, Tue Jul 10 21:19:47 2001 UTC vs.
Revision 1.7 by root, Thu Jul 19 02:45:09 2001 UTC

20 20
21=cut 21=cut
22 22
23package Coro::Semaphore; 23package Coro::Semaphore;
24 24
25use Coro::Process (); 25use Coro ();
26 26
27$VERSION = 0.01; 27$VERSION = 0.08;
28 28
29=item new [inital count, default zero] 29=item new [inital count, default zero]
30 30
31Creates a new sempahore object with the given initial lock count. The 31Creates a new sempahore object with the given initial lock count. The
32default lock count is 1, which means it is unlocked by default. 32default lock count is 1, which means it is unlocked by default.
45=cut 45=cut
46 46
47sub down { 47sub down {
48 my $self = shift; 48 my $self = shift;
49 while ($self->[0] <= 0) { 49 while ($self->[0] <= 0) {
50 push @{$self->[1]}, $Coro::Process::current; 50 push @{$self->[1]}, $Coro::current;
51 Coro::Process::schedule; 51 Coro::schedule;
52 } 52 }
53 --$self->[0]; 53 --$self->[0];
54} 54}
55 55
56=item $sem->up 56=item $sem->up

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines