Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TMutex.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/thread:$Id$
0002 // Author: Fons Rademakers   26/06/97
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TMutex
0013 #define ROOT_TMutex
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TMutex                                                               //
0019 //                                                                      //
0020 // This class implements mutex locks. A mutex is a mutual exclusive     //
0021 // lock. The actual work is done via the TMutexImp class (either        //
0022 // TPosixMutex or TWin32Mutex).                                         //
0023 //                                                                      //
0024 //////////////////////////////////////////////////////////////////////////
0025 
0026 #include "TVirtualMutex.h"
0027 #include "TMutexImp.h"
0028 
0029 
0030 class TMutex : public TVirtualMutex {
0031 
0032 friend class TCondition;
0033 friend class TThread;
0034 
0035 private:
0036    TMutexImp  *fMutexImp;   // pointer to mutex implementation
0037 
0038    TMutex(const TMutex&) = delete;
0039    TMutex& operator=(const TMutex&) = delete;
0040 
0041 public:
0042    TMutex(Bool_t recursive = kFALSE);
0043    virtual ~TMutex() { delete fMutexImp; }
0044 
0045    Int_t  Lock() override;
0046    Int_t  TryLock() override;
0047    Int_t  UnLock() override;
0048    Int_t  CleanUp() override;
0049 
0050    // Compatibility with standard library
0051    void lock() { TMutex::Lock(); }
0052    void unlock() { TMutex::UnLock(); }
0053 
0054    TVirtualMutex *Factory(Bool_t recursive = kFALSE) override;
0055 
0056    ClassDefOverride(TMutex,0)  // Mutex lock class
0057 };
0058 
0059 #endif