Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/Deprecated/Posix.old/Mutex.hpp

Go to the documentation of this file.
00001 #ifndef __J2K__PThread_Mutex_HPP__
00002 #define __J2K__PThread_Mutex_HPP__
00003 
00004 /*
00005  * A fast mutex for synchronizing non-recursive methods.
00006  * Use a Lock to lock and unlock a Mutex.
00007  * Use a RecursiveMutex if you need to be able to lock a mutex
00008  * more than once before unlocking it.
00009  *
00010  * This class is not reference-counted; each instance
00011  * is intended to be encapsulated as a member variable
00012  * by the object that uses it.
00013  */
00014 
00015 #include <pthread.h>
00016 
00017 class Lock;
00018 
00019 class Mutex {
00020 public:
00021   Mutex();
00022   virtual ~Mutex();
00023 
00024 protected:
00025   virtual void lock();
00026   virtual void unlock();
00027   virtual void wait();
00028 
00029 private:
00030   Mutex(const Mutex& src );
00031   Mutex& operator=(const Mutex& right);
00032   void notify();
00033   void notifyAll();
00034 
00035 private:
00036   pthread_mutex_t     mutex;
00037   pthread_mutexattr_t mutexAttr;
00038   pthread_cond_t      cond;
00039   pthread_condattr_t  condAttr;
00040 
00041   friend class Lock;
00042 };
00043 
00044 #include <j2k/Fred/PThread/Lock.hpp>
00045 #include <j2k/Fred/PThread/Lock.cpp>
00046 
00047 #endif

Generated on Sun Oct 14 18:46:23 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001