Changeset 2759 in Sophya for trunk/SophyaLib/SysTools/zthread.h


Ignore:
Timestamp:
May 24, 2005, 6:29:28 PM (20 years ago)
Author:
ansari
Message:

Amelioration de l'interface ZSync() + ajout commentaires - Reza 24/05/2005

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/SysTools/zthread.h

    r2753 r2759  
    7777  inline void   wait()
    7878    { pthread_cond_wait(_condv, _mutx); }
    79   //! Signal a condition change on the mutex object
     79  //! Signal a condition change on the mutex object.
    8080  inline void   signal()
    8181  { pthread_cond_signal(_condv); }
     
    9595  Constructor. Locks the associated ZMutex.
    9696 
     97  - <tt> sigbr==0 </tt> No calls to signal() or broadcast()
     98  in destructor
    9799  - <tt> sigbr==1 </tt> destructor calls \c signal on
    98100  the associated ZMutex
     
    101103*/
    102104  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(); }
    104113  inline           ~ZSync()
    105114  {
     
    110119    }
    111120  }
     121//! Calls the wait method on the associated ZMutex object
     122  inline void wait() { if (_mtx) _mtx->wait(); }
    112123//! To avoid warnings about unused variables
    113124  inline int NOp() { return _sigbr; }
Note: See TracChangeset for help on using the changeset viewer.