Libbarrett  1.2.4
include/barrett/thread/abstract/mutex.h
00001 /*
00002  * mutex.h
00003  *
00004  *  Created on: Dec 15, 2009
00005  *      Author: dc
00006  */
00007 
00008 #ifndef BARRETT_THREAD_ABSTRACT_MUTEX_H_
00009 #define BARRETT_THREAD_ABSTRACT_MUTEX_H_
00010 
00011 
00012 #include <boost/thread.hpp>
00013 #include <barrett/detail/ca_macro.h>
00014 
00015 
00016 #define BARRETT_SCOPED_LOCK(mutex)  \
00017         ::boost::lock_guard< ::barrett::thread::Mutex> _barrett_scoped_lock_lg(mutex)
00018 
00019 
00020 namespace barrett {
00021 namespace thread {
00022 
00023 
00024 // An abstract, recursive mutex object. Is a model of the boost::thread::Lockable concept.
00025 class Mutex {
00026 public:
00027         Mutex() {}
00028         virtual ~Mutex() {}
00029 
00030         virtual void lock() = 0;
00031         virtual bool try_lock() = 0;
00032         virtual void unlock() = 0;
00033 
00034         virtual int fullUnlock() = 0;
00035         virtual void relock(int lc) = 0;
00036 
00037 private:
00038         DISALLOW_COPY_AND_ASSIGN(Mutex);
00039 };
00040 
00041 
00042 }
00043 }
00044 
00045 
00046 #endif /* BARRETT_THREAD_ABSTRACT_MUTEX_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Defines