00001 /* 00002 * $Id: Mutex.h,v 1.10 2003/07/23 16:41:58 mindstorm2600 Exp $ 00003 */ 00004 /* 00005 * $Log: Mutex.h,v $ 00006 * Revision 1.10 2003/07/23 16:41:58 mindstorm2600 00007 * The mutex member is now public, at least temporarily 00008 * 00009 * Revision 1.9 2003/06/30 00:18:06 mindstorm2600 00010 * Fixing some documentation warnings 00011 * 00012 * Revision 1.8 2003/06/23 03:27:32 mindstorm2600 00013 * Some comments got modified 00014 * 00015 * Revision 1.7 2003/06/20 16:40:21 mindstorm2600 00016 * Now is under a new interface, Threading 00017 * 00018 * Revision 1.6 2003/06/12 20:22:02 mindstorm2600 00019 * Adding support for ERRORCHECKING threads on Linux 00020 * 00021 * Revision 1.5 2003/06/12 13:41:46 mindstorm2600 00022 * Now we implement support for native POSIX threads libraries on unix based OSes 00023 * 00024 * Revision 1.4 2002/08/10 17:06:26 mindstorm2600 00025 * Increasing windows portability 00026 * 00027 * Revision 1.3 2002/07/08 04:58:12 mindstorm2600 00028 * Adding every class to the clawsoft namespace 00029 * 00030 * Revision 1.2 2002/07/06 04:47:44 mindstorm2600 00031 * Adding more documentation 00032 * 00033 * Revision 1.1 2002/07/06 03:31:27 mindstorm2600 00034 * Filenames and classnames changed succesfully 00035 * 00036 * Revision 1.5 2002/07/02 02:55:23 mindstorm2600 00037 * Fixing a few documentation discrepancies 00038 * 00039 * Revision 1.4 2002/07/01 04:15:33 mindstorm2600 00040 * Adding an appropiated destructor and the requested exceptions 00041 * 00042 * Revision 1.3 2002/07/01 03:37:48 mindstorm2600 00043 * Adding more thread abstraction, now using SDL's threads interface 00044 * 00045 * Revision 1.2 2002/06/26 05:48:30 mindstorm2600 00046 * cambie el nombre de la clase 00047 * 00048 * Revision 1.1 2002/06/26 05:45:50 mindstorm2600 00049 * These are the thread synchronization classes 00050 * 00051 */ 00052 #ifndef ___MUTEX_H__ 00053 #define ___MUTEX_H__ 00054 00055 #ifdef USE_GNUPTH 00056 #include<pth.h> 00057 #else 00058 #ifdef USE_SDL 00059 #include<SDL.h> 00060 #else 00061 #include<pthread.h> 00062 #endif 00063 #endif 00064 00065 #include<Exception.h> 00066 #include<Threading.h> 00067 namespace clawsoft{ 00068 00069 00075 class Mutex:public Threading{ 00076 private: 00081 void destroy(); 00082 public: 00084 #ifdef USE_GNUPTH 00085 pth_mutex_t mutex; 00086 #else 00087 #ifdef USE_SDL 00088 SDL_mutex *mutex; 00089 #else 00090 pthread_mutex_t mutex; 00091 pthread_mutexattr_t m_attr; 00092 #endif 00093 #endif 00094 00099 Mutex(int autoinit = 1); 00104 ~Mutex(){ 00105 destroy(); 00106 } 00107 00112 void init(); 00113 00117 void lock(); 00118 00122 void unlock(); 00123 }; 00124 00125 }; 00126 00127 #endif
Authors:
Juan V. Guerrero
Jannette C. Mejia
Juan C. Guevara
Powered by: