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.126 by root, Fri Dec 7 22:37:24 2012 UTC vs.
Revision 1.127 by root, Thu Dec 13 01:50:29 2012 UTC

17=head1 DESCRIPTION 17=head1 DESCRIPTION
18 18
19This module implements counting semaphores. You can initialize a mutex 19This module implements counting semaphores. You can initialize a mutex
20with any level of parallel users, that is, you can intialize a sempahore 20with any level of parallel users, that is, you can intialize a sempahore
21that can be C<down>ed more than once until it blocks. There is no owner 21that can be C<down>ed more than once until it blocks. There is no owner
22associated with semaphores, so one thread can C<down> it while another 22associated with semaphores, so one thread can C<down> it while another can
23can C<up> it. 23C<up> it (or vice versa), C<up> can be called before C<down> and so on:
24the semaphore is really just an integer counter that optionally blocks
25when it is 0.
24 26
25Counting semaphores are typically used to coordinate access to 27Counting semaphores are typically used to coordinate access to
26resources, with the semaphore count initialized to the number of free 28resources, with the semaphore count initialized to the number of free
27resources. Threads then increment the count when resources are added 29resources. Threads then increment the count when resources are added
28and decrement the count when resources are removed. 30and decrement the count when resources are removed.
29 31
30You don't have to load C<Coro::Semaphore> manually, it will be loaded 32You don't have to load C<Coro::Semaphore> manually, it will be loaded
31automatically when you C<use Coro> and call the C<new> constructor. 33automatically when you C<use Coro> and call the C<new> constructor.
32 34
33=over 4 35=over 4
34 36
35=cut 37=cut
36 38

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines