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

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

Go to the documentation of this file.
00001 // Started by Harry
00002 // Finished by Fred
00003 
00004 #ifndef __J2K__PThread_Mutex_HPP__
00005 #define __J2K__PThread_Mutex_HPP__
00006 
00007 #include <j2k/Fred/Standard.hpp>
00008 #include <pthread.h>
00009 #include <time.h>
00010 #include <j2k/Fred/Error/JErrorController.hpp>
00011 
00012 // Uses:
00013 // pthread_mutex_t
00014 // pthread_mutex_attr_t
00015 // pthread_cond_t
00016 // pthread_cond_attr_t
00017 
00018 class Lock;
00019 
00020 class PThread_Mutex {
00021 public:
00022 
00023 /***********************************************
00024   Description of pthread_mutex_attr_t arguments.
00025 
00026   Attribute         Default Value
00027   =========         =============
00028   detachstate       PTHREAD_CREATE_JOINABLE
00029   schedpolicy       PTHREAD_INHERIT_SCHED
00030   schedparam        Inherited from parent thread
00031   contentionscope   PTHREAD_SCOPE_SYSTEM
00032   stacksize         4096
00033   stackaddr         NULL
00034 */
00035 
00036   // Default Constructor
00037   inline PThread_Mutex();
00038 
00039   // Destructor
00040   inline virtual ~PThread_Mutex();
00041 
00042   // Lock the mutex
00043   inline void lock();
00044 
00045   // Unlock the mutex
00046   inline void unlock();
00047 
00048   // Try to lock a mutex
00049   inline void tryLock();
00050 
00051   // Get the maximum priority (ceiling value) for the mutex
00052   inline int getPriorityCeiling();
00053 
00054   // Set the maximum priority (ceiling value) for the mutex
00055   inline int setPriorityCeiling( int new_ceiling );
00056 
00057   // Get the mutex attribute type
00058   inline int getType();
00059 
00060   // Get the mutex attribute protocol
00061   inline int getProtocol();
00062 
00063 #if 0
00064 protected:
00065   // Wait for a mutex
00066   inline void wait();
00067 
00068   // Send a notify signal for other process waiting for the mutex
00069   inline void notify();
00070 
00071   // Send a notifyAll broadcast signal for other process waiting for the mutex
00072   inline void notifyAll();
00073 #endif
00074 
00075 private:
00076   int  mutex_type;
00077   int  protocol;
00078   int  prioceiling;
00079 
00080   pthread_mutexattr_t attr;
00081   pthread_mutex_t     mutex;
00082 
00083 //  pthread_cond_t      cond;
00084 //  pthread_condattr_t  cond_attr;
00085 
00086 // public:
00087 //  friend class Lock;
00088 
00089 private:
00090 
00091   // Copy constructor
00092   inline PThread_Mutex( const PThread_Mutex& src );
00093 
00094   // Assign operator
00095   inline const PThread_Mutex& operator=( const PThread_Mutex& src );
00096 };
00097 
00098 typedef PThread_Mutex  Mutex;
00099 
00100 #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