ScopedRWLock.h
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 // This file is part of FZIs ic_workspace.
00005 //
00006 // This program is free software licensed under the LGPL
00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00008 // You can find a copy of this license in LICENSE folder in the top
00009 // directory of the source code.
00010 //
00011 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00012 //
00013 // -- END LICENSE BLOCK ------------------------------------------------
00014 
00015 //----------------------------------------------------------------------
00028 //----------------------------------------------------------------------
00029 #ifndef ICL_CORE_THREAD_SCOPED_RWLOCK_H_INCLUDED
00030 #define ICL_CORE_THREAD_SCOPED_RWLOCK_H_INCLUDED
00031 
00032 #include <icl_core/BaseTypes.h>
00033 #include <icl_core/Noncopyable.h>
00034 #include "icl_core_thread/ImportExport.h"
00035 
00036 #ifdef _IC_BUILDER_DEPRECATED_STYLE_
00037 # include "icl_core/Deprecate.h"
00038 #endif
00039 
00040 namespace icl_core {
00041 namespace thread {
00042 
00043 class RWLock;
00044 
00050 class ICL_CORE_THREAD_IMPORT_EXPORT ScopedRWLock : protected virtual icl_core::Noncopyable
00051 {
00052 public:
00054   enum LockMode
00055   {
00056     eLM_READ_LOCK,      
00057     eLM_WRITE_LOCK      
00058   };
00059 
00066   explicit ScopedRWLock(RWLock& lock, LockMode lock_mode, bool force = true);
00067 
00070   ~ScopedRWLock();
00071 
00074   bool isLocked() const { return m_is_locked; }
00075 
00079   operator bool () const { return isLocked(); }
00080 
00082 #ifdef _IC_BUILDER_DEPRECATED_STYLE_
00083 
00087   ICL_CORE_VC_DEPRECATE_STYLE bool IsLocked() const ICL_CORE_GCC_DEPRECATE_STYLE;
00088 
00089 #endif
00090 
00091 
00092 private:
00093   RWLock& m_lock;
00094   bool m_is_locked;
00095 };
00096 
00097 }
00098 }
00099 
00100 #endif


fzi_icl_core
Author(s):
autogenerated on Thu Jun 6 2019 20:22:24