wefts_xmutex.h

Go to the documentation of this file.
00001 /* 00002 wefts_xmutex.h 00003 Advanced mutex 00004 00005 $Id: wefts_xmutex.h,v 1.3 2004/03/28 21:45:40 jonnymind Exp $ 00006 --------------------------------------------- 00007 Begin : 2003-08-16 21:07 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_XMUTEX_H 00022 #define WT_XMUTEX_H 00023 00024 #include <wefts_mutex.h> 00025 #include <wefts_cond.h> 00026 #include <wefts_cleanup.h> 00027 00028 00029 namespace Wefts { 00030 00064 class XMutex: public CleanupHandler { 00065 private: 00066 Condition m_cond; 00067 Mutex m_mutex; 00068 int m_locked; 00069 int m_waiting; 00070 OSThread m_owner; 00071 00072 public: 00074 XMutex(); 00075 00084 void lock(); 00085 00090 bool lock( double seconds ); 00091 00095 bool tryLock(); 00096 00101 void unlock(); 00102 00104 bool own() { return m_owner.same(); } 00105 00111 bool locked() { return m_locked > 0; } 00112 00114 void handleCleanup( int, void *caller = 0 ); 00115 }; 00116 00117 } 00118 00119 #endif 00120 00121 /* end of wefts_xmutex.h */

Generated on Tue Oct 5 14:57:00 2004 for Wefts by doxygen 1.3.7