00001 // 00002 // CascadeMutex.h - header file for class CascadeMutex 00003 // 00004 // Copyright (c) 2002, Roku, LLC. All rights reserved. 00005 // 00008 00009 #ifndef _ROKU_INCLUDE_CASCADE_INTERTHREAD_CASCADEMUTEX_H 00010 #define _ROKU_INCLUDE_CASCADE_INTERTHREAD_CASCADEMUTEX_H 00011 00012 #include <cascade/CascadeObject.h> 00013 00025 class CascadeMutex : public CascadeObject 00026 { 00027 public: 00028 CascadeMutex(); 00032 virtual ~CascadeMutex(); 00036 public: 00037 void Lock(); 00040 // Call %Lock() to lock the mutex. If the mutex is locked by another thread 00041 // the calling thread will block until the mutex is locked. 00042 // %Locks() can be nested. 00043 // @note Only use %CascadeMutex for mutual exclusion on threads. 00044 // For mutual exclusion on processes, use %CascadeSemLock instead. 00046 bool TryLock(); 00055 void Unlock(); 00061 private: 00062 class Mutex; 00063 Mutex * m_pMutex; 00064 }; 00065 00066 #endif // #ifndef _ROKU_INCLUDE_CASCADE_INTERTHREAD_CASCADEMUTEX_H 00067 00069 // LOG 00071 // 20-Dec-02 dwoodward created 00072 // 20-Jan-03 dwoodward 1.0 STATUS: 100% complete 00073 // 05-May-03 dwoodward doxygenated 00074 // 15-Mar-04 dwoodward use private nested forward declared class instead of void * 00075 // for private impl 00076