Go to the documentation of this file.00001
00002
00009
00010
00011 #include "Semaphore.h"
00012
00013 #if defined _SYSTEM_LXRT_
00014 # include "SemaphoreImplLxrt.h"
00015 #endif
00016
00017 #if defined _SYSTEM_DARWIN_
00018 # include "SemaphoreImplDarwin.h"
00019 #elif defined _SYSTEM_POSIX_
00020 # include "SemaphoreImplPosix.h"
00021 #elif defined _SYSTEM_WIN32_
00022 # include "SemaphoreImplWin32.h"
00023 #else
00024 # error "No semaphore implementation defined for this platform."
00025 #endif
00026
00027 namespace icl_core {
00028 namespace logging {
00029
00030 Semaphore::Semaphore(size_t initial_value)
00031 : m_impl(0)
00032 {
00033 #if defined _SYSTEM_LXRT_
00034
00035
00036
00037
00038
00039
00040 if (icl_core::os::isLxrtAvailable())
00041 {
00042 m_impl = new SemaphoreImplLxrt(initial_value);
00043 }
00044 else
00045 {
00046 m_impl = new SemaphoreImplPosix(initial_value);
00047 }
00048
00049 #elif defined _SYSTEM_DARWIN_
00050 m_impl = new SemaphoreImplDarwin(initial_value);
00051
00052 #elif defined _SYSTEM_POSIX_
00053 m_impl = new SemaphoreImplPosix(initial_value);
00054
00055 #elif defined _SYSTEM_WIN32_
00056 m_impl = new SemaphoreImplWin32(initial_value);
00057
00058 #endif
00059 }
00060
00061 Semaphore::~Semaphore()
00062 {
00063 delete m_impl;
00064 m_impl = 0;
00065 }
00066
00067 void Semaphore::post()
00068 {
00069 return m_impl->post();
00070 }
00071
00072 bool Semaphore::wait()
00073 {
00074 return m_impl->wait();
00075 }
00076
00078 #ifdef _IC_BUILDER_DEPRECATED_STYLE_
00079
00081 void Semaphore::Post()
00082 {
00083 post();
00084 }
00085
00092 bool Semaphore::Wait()
00093 {
00094 return wait();
00095 }
00096
00097 #endif
00098
00099
00100 }
00101 }