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 //---------------------------------------------------------------------- 00026 //---------------------------------------------------------------------- 00027 #ifndef ICL_CORE_LOGGING_SEMAPHORE_H_INCLUDED 00028 #define ICL_CORE_LOGGING_SEMAPHORE_H_INCLUDED 00029 00030 #include <icl_core/BaseTypes.h> 00031 #include <icl_core/Noncopyable.h> 00032 #include "icl_core_logging/ImportExport.h" 00033 00034 #ifdef _IC_BUILDER_DEPRECATED_STYLE_ 00035 # include "icl_core/Deprecate.h" 00036 #endif 00037 00038 namespace icl_core { 00039 namespace logging { 00040 00041 class SemaphoreImpl; 00042 00044 class ICL_CORE_LOGGING_IMPORT_EXPORT Semaphore : protected virtual icl_core::Noncopyable 00045 { 00046 public: 00047 Semaphore(size_t initial_value = 1); 00048 virtual ~Semaphore(); 00049 00051 void post(); 00052 00059 bool wait(); 00060 00062 #ifdef _IC_BUILDER_DEPRECATED_STYLE_ 00063 00065 ICL_CORE_VC_DEPRECATE_STYLE void Post() ICL_CORE_GCC_DEPRECATE_STYLE; 00066 00073 ICL_CORE_VC_DEPRECATE_STYLE bool Wait() ICL_CORE_GCC_DEPRECATE_STYLE; 00074 00075 #endif 00076 00077 00078 private: 00079 SemaphoreImpl *m_impl; 00080 }; 00081 00082 } 00083 } 00084 00085 #endif