#include <XrdSysSemWait.hh>
Definition at line 34 of file XrdSysSemWait.hh.
◆ XrdSysSemWait()
XrdSysSemWait::XrdSysSemWait |
( |
int | semval = 1, |
|
|
const char * | cid = 0 ) |
|
inline |
Definition at line 109 of file XrdSysSemWait.hh.
109 : semVar(0, cid) {
110 semVal = semval; semWait = 0;
111 }
◆ ~XrdSysSemWait()
XrdSysSemWait::~XrdSysSemWait |
( |
| ) |
|
|
inline |
◆ CondWait()
int XrdSysSemWait::CondWait |
( |
| ) |
|
|
inline |
Definition at line 37 of file XrdSysSemWait.hh.
37 {
38
39 int rc = 0;
40
41
42
43
44
45 semVar.Lock();
46 if (semVal > 0) semVal--;
47 else {
48 rc = 1;
49 }
50
51 semVar.UnLock();
52
53 return rc;
54
55 };
◆ Post()
void XrdSysSemWait::Post |
( |
| ) |
|
|
inline |
Definition at line 57 of file XrdSysSemWait.hh.
57 {
58
59
60
61 semVar.Lock();
62
63 if (semWait > 0) {
64 semVar.Signal();
65 semWait--;
66 }
67 else
68 semVal++;
69
70 semVar.UnLock();
71 };
◆ Wait() [1/2]
void XrdSysSemWait::Wait |
( |
| ) |
|
|
inline |
Definition at line 73 of file XrdSysSemWait.hh.
73 {
74
75
76
77
78 semVar.Lock();
79 if (semVal > 0) semVal--;
80 else {
81 semWait++;
82 semVar.Wait();
83 }
84
85 semVar.UnLock();
86
87 };
◆ Wait() [2/2]
int XrdSysSemWait::Wait |
( |
int | secs | ) |
|
|
inline |
Definition at line 89 of file XrdSysSemWait.hh.
89 {
90 int rc = 0;
91
92
93
94
95
96 semVar.Lock();
97 if (semVal > 0) semVal--;
98 else {
99 semWait++;
100 rc = semVar.Wait(secs);
101 if (rc) semWait--;
102 }
103
104 semVar.UnLock();
105
106 return rc;
107 };
The documentation for this class was generated from the following file: