00001 #ifndef MUTEX_CLASS 00002 #define MUTEX_CLASS 00003 00004 /*****************************************************************************\ 00005 * * 00006 * Name : mutex * 00007 * Author : Chris Koeritz * 00008 * * 00009 ******************************************************************************* 00010 * Copyright (c) 1996-$now By Author. This program is free software; you can * 00011 * redistribute it and/or modify it under the terms of the GNU General Public * 00012 * License as published by the Free Software Foundation; either version 2 of * 00013 * the License or (at your option) any later version. This is online at: * 00014 * http://www.fsf.org/copyleft/gpl.html * 00015 * Please send any updates to: fred@gruntose.com * 00016 \*****************************************************************************/ 00017 00018 #include "auto_synch.h" 00019 // we include auto_synch here because it is so often used with mutexes. 00020 00022 00031 class mutex_base : public synchronizer_base 00032 { 00033 public: 00034 mutex_base(); 00035 00036 virtual ~mutex_base(); 00038 00040 void construct(); 00042 void destruct(); 00043 00044 void lock(); 00046 00048 void unlock(); 00050 00051 virtual void establish_lock(); 00053 virtual void repeal_lock(); 00055 00056 void defang(); 00058 00063 private: 00064 void *_os_mutex; 00065 00066 mutex_base(const mutex_base &); 00067 mutex_base &operator =(const mutex_base &); 00068 }; 00069 00071 00073 00074 class mutex : public mutex_base, public virtual object_base 00075 { 00076 public: 00077 virtual ~mutex(); 00078 IMPLEMENT_CLASS_NAME("mutex"); 00079 }; 00080 00081 #endif 00082
1.5.1