Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   Related Pages  

wefts_rwmutex.h

Go to the documentation of this file.
00001 /*
00002    wefts_rwmutex.h
00003    Read/write Non Reentrant Mutex object header file.
00004 
00005    $Id: wefts_rwmutex.h,v 1.6 2003/08/17 01:15:19 jonnymind Exp $
00006 ---------------------------------------------
00007    Begin      : 2003-08-02 20:58
00008    Author     : Giancarlo Niccolai
00009 
00010    Last modified because:
00011 
00012 */
00013 
00014 /**************************************************************************
00015 *   This program is free software; you can redistribute it and/or modify  *
00016 *   it under the terms of the GNU Library General Public License as       *
00017 *   published by the Free Software Foundation; either version 2.1 of the  *
00018 *   License, or (at your option) any later version.                       *
00019 ***************************************************************************/
00020 
00021 #ifndef WT_RWMUTEX_H
00022 #define WT_RWMUTEX_H
00023 
00024 #include <wefts_cleanup.h>
00025 #include <wefts_mutex.h>
00026 #include <wefts_cond.h>
00027 #include <wefts_error.h>
00028 
00029 #ifndef NO_ASSERTION
00030 #include <cassert>
00031 #endif
00032 
00033 namespace Wefts {
00034 
00066 class RWMutex: public CleanupHandler
00067 {
00068 protected:
00069    Mutex  m_mutex;
00070    Condition m_condRead;
00071    Condition m_condWrite;
00072 
00073    int m_locking;
00074    int m_waitingRead;
00075    int m_waitingWrite;
00076    int m_promoting;
00077 
00078 public:
00080    RWMutex();
00081 
00098    virtual bool lockRead( double time = 0.0 );
00099 
00106    virtual bool tryLockRead();
00107 
00108 
00127    virtual bool lockWrite( double time =0.0 );
00128 
00140    virtual bool tryLockWrite();
00141 
00142 
00175    virtual bool promote( double time = 0.0 ) throw( InvalidError );
00176 
00177 
00184    virtual bool tryPromote();
00185 
00186 
00194    virtual void unlock() throw ( InvalidError );
00195 
00196    virtual void handleCleanup( int code );
00197 };
00198 
00199 }
00200 
00201 #endif
00202 /* end of wefts_rwmutex.h */

Generated on Mon Aug 18 05:53:37 2003 for Wefts by doxygen1.2.18