ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Coro/RWLock.pm
Revision: 1.1
Committed: Wed Jul 25 21:12:57 2001 UTC (22 years, 10 months ago) by root
Branch: MAIN
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 =head1 NAME
2    
3     Coro::RWLock - reader/write locks
4    
5     =head1 SYNOPSIS
6    
7     use Coro::RWLock;
8    
9     $lck = new Coro::RWLock;
10    
11     $lck->rdlock; # acquire read lock
12    
13     $lck->unlock;
14    
15     =head1 DESCRIPTION
16    
17     This module implements reader/write locks. A read can be acquired for
18     read by many coroutines in parallel as long as no writer has locked it
19     (shared access). A single write lock can be acquired when no readers
20     exist. RWLocks basically allow many concurrent readers (without writers)
21     OR a single writer (but no readers).
22    
23     =over 4
24    
25     =cut
26    
27     package Coro::RWLock;
28    
29     use Coro ();
30    
31     $VERSION = 0.12;
32    
33     die "NYI";
34    
35     =item $l = new Coro::RWLock;
36    
37     Create a new reader/writer lock.
38    
39     =cut
40    
41     sub new {
42     # [wrcount, rdcount, [readqueue], [waitqueue]]
43     bless [0, 0, [], []], $_[0];
44     }
45    
46     =item $l->rdlock
47    
48     Acquire a read lock.
49    
50     =item $l->tryrdlock
51    
52     Try to acquire a read lock.
53    
54     =cut
55    
56     sub rdlock {
57     }
58    
59     1;
60    
61     =back
62    
63     =head1 AUTHOR
64    
65     Marc Lehmann <pcg@goof.com>
66     http://www.goof.com/pcg/marc/
67    
68     =cut
69