25 #ifndef STTCLSEMAPHORE_H_
26 #define STTCLSEMAPHORE_H_
30 #ifndef STTCL_DEFAULT_SEMAPHOREIMPL
31 #if defined(STTCL_POSIX_SEMAPHORE) or defined(STTCL_POSIX_IMPL)
32 #include "../PosixThreads/SttclPosixSemaphore.h"
33 #define STTCL_DEFAULT_SEMAPHOREIMPL sttcl::internal::posix_impl::SttclPosixSemaphore
34 #elif defined(STTCL_BOOST_SEMAPHORE) or defined(STTCL_BOOST_IMPL)
35 #include "../BoostThreads/SttclBoostSemaphore.h"
36 #define STTCL_DEFAULT_SEMAPHOREIMPL sttcl::internal::boost_impl::SttclBoostSemaphore
37 #elif defined(STTCL_CX11_SEMAPHORE) or defined(STTCL_CX11_IMPL)
38 #include "../C++11Threads/SttclCx11Semaphore.h"
39 #define STTCL_DEFAULT_SEMAPHOREIMPL sttcl::internal::cx11_impl::SttclCx11Semaphore
42 #ifndef STTCL_DEFAULT_SEMAPHOREIMPL
43 #error "You need to define a default semaphore implementation for sttcl"
59 <
class Impl = STTCL_DEFAULT_SEMAPHOREIMPL
60 ,
class TimeDurationType = TimeDuration<STTCL_DEFAULT_TIMEDURATIONIMPL>
81 static_cast<Impl*
>(
this)->
wait();
90 bool try_wait(
const TimeDurationType& timeout = TimeDurationType::Zero)
92 return static_cast<Impl*
>(
this)->
try_wait(timeout);
100 static_cast<Impl*
>(
this)->
post();