00001 // @(#)root/thread:$Id: TMutex.h 29797 2009-08-17 14:35:51Z rdm $ 00002 // Author: Fons Rademakers 26/06/97 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TMutex 00013 #define ROOT_TMutex 00014 00015 00016 ////////////////////////////////////////////////////////////////////////// 00017 // // 00018 // TMutex // 00019 // // 00020 // This class implements mutex locks. A mutex is a mutual exclusive // 00021 // lock. The actual work is done via the TMutexImp class (either // 00022 // TPosixMutex or TWin32Mutex). // 00023 // // 00024 ////////////////////////////////////////////////////////////////////////// 00025 00026 #ifndef ROOT_TVirtualMutex 00027 #include "TVirtualMutex.h" 00028 #endif 00029 #ifndef ROOT_TThread 00030 #include "TThread.h" 00031 #endif 00032 #ifndef ROOT_TMutexImp 00033 #include "TMutexImp.h" 00034 #endif 00035 00036 00037 class TMutex : public TVirtualMutex { 00038 00039 friend class TCondition; 00040 friend class TThread; 00041 00042 private: 00043 TMutexImp *fMutexImp; // pointer to mutex implementation 00044 00045 TMutex(const TMutex&); // not implemented 00046 TMutex& operator=(const TMutex&); // not implemented 00047 00048 public: 00049 TMutex(Bool_t recursive = kFALSE); 00050 virtual ~TMutex() { delete fMutexImp; } 00051 00052 Int_t Lock(); 00053 Int_t TryLock(); 00054 Int_t UnLock(); 00055 Int_t CleanUp(); 00056 00057 TVirtualMutex *Factory(Bool_t recursive = kFALSE); 00058 00059 ClassDef(TMutex,0) // Mutex lock class 00060 }; 00061 00062 #endif