Changeset 2759 in Sophya
- Timestamp:
- May 24, 2005, 6:29:28 PM (20 years ago)
- Location:
- trunk/SophyaLib/SysTools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SysTools/zthread.cc
r2615 r2759 138 138 of the POSIX threads. 139 139 The ZMutex objects should be used to control acces from different threads 140 to common objects through the \b lock() and \b unlock() methods. 140 to common objects through the \b lock() and \b unlock() methods. 141 When the \b signal() method is called, one of the waiting threads 142 on the corresponding mutex object (\b ZMutex::wait()) is awakened. 143 All waiting threads on the mutex object are awakened when \b broadcast() 144 is called. 141 145 \sa SOPHYA::ZSync 142 146 */ -
trunk/SophyaLib/SysTools/zthread.h
r2753 r2759 77 77 inline void wait() 78 78 { pthread_cond_wait(_condv, _mutx); } 79 //! Signal a condition change on the mutex object 79 //! Signal a condition change on the mutex object. 80 80 inline void signal() 81 81 { pthread_cond_signal(_condv); } … … 95 95 Constructor. Locks the associated ZMutex. 96 96 97 - <tt> sigbr==0 </tt> No calls to signal() or broadcast() 98 in destructor 97 99 - <tt> sigbr==1 </tt> destructor calls \c signal on 98 100 the associated ZMutex … … 101 103 */ 102 104 explicit inline ZSync(ZMutex & mtx, int sigbr=0) 103 {_mtx = &mtx; _sigbr = sigbr; mtx.lock(); } 105 {_mtx = &mtx; _sigbr = sigbr; _mtx->lock(); } 106 107 /*! 108 Constructor from ZMutex pointer. 109 Locks the associated ZMutex object if non null pointer 110 */ 111 explicit inline ZSync(ZMutex * mtxp, int sigbr=0) 112 {_mtx = mtxp; _sigbr = sigbr; if (_mtx) _mtx->lock(); } 104 113 inline ~ZSync() 105 114 { … … 110 119 } 111 120 } 121 //! Calls the wait method on the associated ZMutex object 122 inline void wait() { if (_mtx) _mtx->wait(); } 112 123 //! To avoid warnings about unused variables 113 124 inline int NOp() { return _sigbr; }
Note:
See TracChangeset
for help on using the changeset viewer.