Changeset 2759 in Sophya


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

Location:
trunk/SophyaLib/SysTools
Files:
2 edited

Legend:

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

    r2615 r2759  
    138138  of the POSIX threads.
    139139  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.
    141145  \sa SOPHYA::ZSync
    142146*/
  • 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.