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

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