00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- 00002 //---------------------------------------------------------------------- 00014 //---------------------------------------------------------------------- 00015 #ifndef ICL_CORE_THREAD_MUTEX_H_INCLUDED 00016 #define ICL_CORE_THREAD_MUTEX_H_INCLUDED 00017 00018 #include "icl_core/Noncopyable.h" 00019 #include "icl_core/TimeSpan.h" 00020 #include "icl_core/TimeStamp.h" 00021 #include "icl_core_thread/ImportExport.h" 00022 00023 #ifdef _IC_BUILDER_DEPRECATED_STYLE_ 00024 # include "icl_core/Deprecate.h" 00025 #endif 00026 00027 namespace icl_core { 00028 namespace thread { 00029 00030 class MutexImpl; 00031 00034 class ICL_CORE_THREAD_IMPORT_EXPORT Mutex : protected virtual icl_core::Noncopyable 00035 { 00036 public: 00039 Mutex(); 00040 00043 virtual ~Mutex(); 00044 00049 bool lock(); 00050 00055 bool lock(const ::icl_core::TimeStamp& timeout); 00056 00061 bool lock(const ::icl_core::TimeSpan& timeout); 00062 00069 bool tryLock(); 00070 00073 void unlock(); 00074 00076 #ifdef _IC_BUILDER_DEPRECATED_STYLE_ 00077 00082 ICL_CORE_VC_DEPRECATE_STYLE bool Lock() ICL_CORE_GCC_DEPRECATE_STYLE; 00083 00088 ICL_CORE_VC_DEPRECATE_STYLE bool Lock(const icl_core::TimeStamp& timeout) 00089 ICL_CORE_GCC_DEPRECATE_STYLE; 00090 00095 ICL_CORE_VC_DEPRECATE_STYLE bool Lock(const icl_core::TimeSpan& timeout) 00096 ICL_CORE_GCC_DEPRECATE_STYLE; 00097 00104 ICL_CORE_VC_DEPRECATE_STYLE bool TryLock() ICL_CORE_GCC_DEPRECATE_STYLE; 00105 00108 ICL_CORE_VC_DEPRECATE_STYLE void Unlock() ICL_CORE_GCC_DEPRECATE_STYLE; 00109 00110 #endif 00111 00112 00113 private: 00114 MutexImpl *m_impl; 00115 }; 00116 00117 } 00118 } 00119 00120 #endif