CPN
Computational Process Networks
PthreadReadWriteLock.h
Go to the documentation of this file.
1 //=============================================================================
2 // PthreadReadWriteLock and protection classes
3 //-----------------------------------------------------------------------------
4 // POSIX Pthread class library
5 // Copyright (C) 1997-1999 The University of Texas
6 //
7 // This library is free software; you can redistribute it and/or modify it
8 // under the terms of the GNU Library General Public License as published
9 // by the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Library General Public License for more details.
16 //
17 // The GNU Public License is available in the file LICENSE, or you
18 // can write to the Free Software Foundation, Inc., 59 Temple Place -
19 // Suite 330, Boston, MA 02111-1307, USA, or you can find it on the
20 // World Wide Web at http://www.fsf.org.
21 //=============================================================================
22 
23 
24 #ifndef PthreadReadWriteLock_h
25 #define PthreadReadWriteLock_h
26 #pragma once
27 
28 #include <cpn/common.h>
30 #ifdef _POSIX_THREADS
31 
35 
36 
38  public:
39  // if (priorityWrites) is true, readers must wait for a pending writer
40  // otherwise, the writer must have some lucky timing!
41  PthreadReadWriteLock(int _priorityWrites = 1);
42 // ~PthreadReadWriteLock(void);
43 
44  void ReadLock(void);
45  void WriteLock(void);
46  void ReadUnlock(void);
47  void WriteUnlock(void);
48 
49  private:
53  int writing;
56 };
57 
58 
60  public:
64  private:
66 };
67 
68 
70  public:
74  private:
76 };
77 
78 
79 #endif
80 #endif
PthreadReadWriteLock * theReadWriteLock
PthreadWriteLockProtected(PthreadReadWriteLock &tl)
PthreadReadLockProtected(PthreadReadWriteLock &tl)
PthreadReadWriteLock(int _priorityWrites=1)
PthreadReadWriteLock * theReadWriteLock
PthreadCondition lockFree