8#ifndef INCLUDED_BSLMT_SEMAPHOREIMPL_PTHREAD
9#define INCLUDED_BSLMT_SEMAPHOREIMPL_PTHREAD
68#include <bslscm_version.h>
72#if defined(BSLMT_PLATFORM_POSIX_SEMAPHORE)
83template <
class SEMAPHORE_POLICY>
94class SemaphoreImpl<Platform::PosixSemaphore> {
101 SemaphoreImpl(
const SemaphoreImpl&);
102 SemaphoreImpl& operator=(
const SemaphoreImpl&);
111 SemaphoreImpl(
int count);
124 void post(
int number);
137 int getValue()
const;
150SemaphoreImpl<bslmt::Platform::PosixSemaphore>::~SemaphoreImpl()
152 int result = ::sem_destroy(&d_sem);
160void SemaphoreImpl<bslmt::Platform::PosixSemaphore>::post()
162 int result = ::sem_post(&d_sem);
169int SemaphoreImpl<bslmt::Platform::PosixSemaphore>::tryWait()
171 return ::sem_trywait(&d_sem);
176int SemaphoreImpl<bslmt::Platform::PosixSemaphore>::getValue()
const
179 int result = ::sem_getvalue(
const_cast<sem_t *
>(&d_sem), &value);
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1976
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1917
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition bslmt_barrier.h:344