Changeset 2212 in Sophya for trunk/SophyaLib/SysTools/zthread.h
- Timestamp:
- Oct 15, 2002, 5:48:53 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SysTools/zthread.h
r1612 r2212 14 14 15 15 typedef void (* ZThreadAction) (void *); 16 16 17 /*! 18 \class SOPHYA::ZThreadExc 19 \ingroup SysTools 20 This exception class is used by the classes implementing the interface 21 to the POSIX threads (\b ZThread ...) 22 */ 17 23 class ZThreadExc : public PException { 18 24 public: … … 31 37 virtual void run(); 32 38 39 //! Sets the return code for the thread object 33 40 inline void setRC(int rc) { _rc = rc; } 41 //! Return the value of the return code for the thread object 34 42 inline int getRC(int rc) { return(_rc); 35 43 } … … 61 69 explicit ZMutex(); 62 70 virtual ~ZMutex(); 71 //! Locks the mutex object 63 72 inline void lock() 64 73 { pthread_mutex_lock(_mutx); } 74 //! Unlocks the mutex object 65 75 inline void unlock() 66 { pthread_mutex_unlock(_mutx); } 76 { pthread_mutex_unlock(_mutx); } 77 //! Waits for a condition change 67 78 inline void wait() 68 79 { pthread_cond_wait(_condv, _mutx); } 80 //! Signal a condition change on the mutex object 69 81 inline void signal() 70 82 { pthread_cond_signal(_condv); } 83 //! Broadcasts a condition change on the mutex object 71 84 inline void broadcast() 72 85 { pthread_cond_broadcast(_condv); } … … 81 94 public: 82 95 explicit inline ZSync(ZMutex & mtx) {_mtx = &mtx; mtx.lock(); } 83 inline ~ZSync() { _mtx->unlock(); }96 inline ~ZSync() { if (_mtx) _mtx->unlock(); } 84 97 85 98 private:
Note:
See TracChangeset
for help on using the changeset viewer.