xrootd
XrdSysXSLock.hh
Go to the documentation of this file.
1 #ifndef __SYS_XSLOCK_HH__
2 #define __SYS_XSLOCK_HH__
3 /******************************************************************************/
4 /* */
5 /* X r d S y s X S L o c k . h h */
6 /* */
7 /* (c) 2003 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC03-76-SFO0515 with the Department of Energy */
11 /******************************************************************************/
12 
13 // $Id$
14 
15 #include <errno.h>
16 #include "XrdSys/XrdSysPthread.hh"
17 
18 // These are valid usage options
19 //
21 
22 // This class implements the shared lock. Any number of readers are allowed
23 // by requesting a shared lock. Only one exclusive writer is allowed by
24 // requesting an exclusive lock. Up/downgrading is not supported.
25 //
27 {
28 public:
29 
30 void Lock(const XrdSysXS_Type usage);
31 
32 void UnLock(const XrdSysXS_Type usage=xs_None);
33 
35  shr_wait(0), toggle(0), WantShr(0), WantExc(0) {}
36  ~XrdSysXSLock();
37 
38 private:
39 
44 int toggle;
45 
49 };
50 #endif