Changeset 2488 in Sophya
- Timestamp:
- Dec 29, 2003, 1:34:11 AM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SysTools/zthread.h
r2212 r2488 93 93 class ZSync { 94 94 public: 95 explicit inline ZSync(ZMutex & mtx) {_mtx = &mtx; mtx.lock(); } 96 inline ~ZSync() { if (_mtx) _mtx->unlock(); } 95 explicit inline ZSync(ZMutex & mtx, int sigbr=0) 96 {_mtx = &mtx; _sigbr = sigbr; mtx.lock(); } 97 inline ~ZSync() 98 { 99 if (_mtx) { 100 _mtx->unlock(); 101 if (_sigbr == 1) _mtx->signal(); 102 else if (_sigbr == 2) _mtx->broadcast(); 103 } 104 } 97 105 98 106 private: 99 107 ZMutex * _mtx; 100 inline ZSync() {_mtx = NULL; } 108 int _sigbr; 109 inline ZSync() {_mtx = NULL; _sigbr = 0; } 101 110 102 111 };
Note:
See TracChangeset
for help on using the changeset viewer.