CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/DQM/CSCMonitorModule/interface/CSCDQM_Lock.h

Go to the documentation of this file.
00001 /*
00002  * =====================================================================================
00003  *
00004  *       Filename:  CSCDQM_Lock.h
00005  *
00006  *    Description:  Lockable interface that blocks current thread.
00007  *
00008  *        Version:  1.0
00009  *        Created:  10/06/2008 01:49:51 PM
00010  *       Revision:  none
00011  *       Compiler:  gcc
00012  *
00013  *         Author:  Valdas Rapsevicius, valdas.rapsevicius@cern.ch
00014  *        Company:  CERN, CH
00015  *
00016  * =====================================================================================
00017  */
00018 
00019 #ifndef CSCDQM_Lock_H
00020 #define CSCDQM_Lock_H
00021 
00022 #ifdef DQMMT      
00023 #include <boost/thread.hpp>
00024 #endif
00025 
00026 namespace cscdqm {
00027 
00028 #ifdef DQMMT
00029   typedef boost::recursive_mutex::scoped_lock LockType;
00030 #else
00031   struct LockType {
00032     bool locked;
00033     LockType(bool locked_) : locked(locked_) { }
00034     void unlock() { locked = false;  }
00035   };
00036 #endif
00037 
00042   class Lock {
00043   
00044     public:
00045 
00047 #ifdef DQMMT
00048       boost::recursive_mutex mutex;
00049 #else
00050       bool mutex;
00051 #endif
00052 
00056       Lock() { }
00057 
00061       virtual ~Lock() { }
00062 
00063   };
00064 
00065 }
00066 
00067 #endif