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

C:/temp/src/j2k/nto/bak2/Mutex.hpp

Go to the documentation of this file.
00001 #ifndef __J2K__PThread_Mutex_HPP__
00002 #define __J2K__PThread_Mutex_HPP__
00003 
00004 #include <j2k/Fred/Standard.hpp>
00005 // #include <j2k/Fred/Error/JErrorController.hpp>
00006 
00007 #define MC_OnError( x, y, z )
00008 
00009 #include <errno.h>
00010 #include <pthread.h>
00011 #include <time.h>
00012 
00013 // Uses:
00014 // pthread_mutex_t
00015 // pthread_mutex_attr_t
00016 
00017 class PThread_Mutex {
00018 public:
00019 
00020 /******************************************************
00021  **  Description of pthread_mutex_attr_t arguments.  **
00022  **                                                  **
00023  **  Attribute         Default Value                 **
00024  **  =========         =============                 **
00025  **  detachstate       PTHREAD_CREATE_JOINABLE       **
00026  **  schedpolicy       PTHREAD_INHERIT_SCHED         **
00027  **  schedparam        Inherited from parent thread  **
00028  **  contentionscope   PTHREAD_SCOPE_SYSTEM          **
00029  **  stacksize         4096                          **
00030  **  stackaddr         NULL                          **
00031  ******************************************************/
00032 
00033   // Default Constructor
00034   PThread_Mutex();
00035 
00036   // Destructor
00037   virtual ~PThread_Mutex();
00038 
00039   // Lock the mutex
00040   void lock();
00041 
00042   // Unlock the mutex
00043   void unlock();
00044 
00045   // Try to lock a mutex
00046   inline void tryLock();
00047 
00048   // Get the maximum priority (ceiling value) for the mutex
00049   inline int getPriorityCeiling();
00050 
00051   // Set the maximum priority (ceiling value) for the mutex
00052   inline int setPriorityCeiling( int new_ceiling );
00053 
00054   // Get the mutex attribute type
00055   inline int getType();
00056 
00057   // Get the mutex attribute protocol
00058   inline int getProtocol();
00059 
00060 private:
00061   int   mutex_type;
00062   int   protocol;
00063   int   prioceiling;
00064   int   state;
00065   pid_t owner;
00066 
00067   pthread_mutexattr_t attr;
00068   pthread_mutex_t     mutex;
00069 
00070 
00071 // Not implemented or needed.
00072 private:
00073   // Copy constructor
00074   inline PThread_Mutex( const PThread_Mutex& src );
00075 
00076   // Assign operator
00077   inline const PThread_Mutex& operator=( const PThread_Mutex& src );
00078 };
00079 
00080 typedef PThread_Mutex  Mutex;
00081 
00082 
00083 #include <j2k/nto/Mutex.inl>
00084 
00085 #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