#include <ace/Synch.h>
class ACE_Semaphore {
public:
ACE_Semaphore ( u_int count = 1, int type = USYNC_THREAD, LPCTSTR name = 0, void * = 0, int max = 0x7fffffff );
~ACE_Semaphore (void);
int remove (void);
int acquire (void);
int acquire (ACE_Time_Value &tv);
int tryacquire (void);
int release (void);
int release (size_t release_count);
int acquire_read (void);
int acquire_write (void);
int tryacquire_read (void);
int tryacquire_write (void);
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
const ACE_sema_t &lock (void) const;
protected:
ACE_sema_t semaphore_;
private:
void operator= (const ACE_Semaphore &);
ACE_Semaphore (const ACE_Semaphore &);
};
ACE_Semaphore (
u_int count = 1,
int type = USYNC_THREAD,
LPCTSTR name = 0,
void * = 0,
int max = 0x7fffffff
);
~ACE_Semaphore (void);
int remove (void);
int acquire (void);
int acquire (ACE_Time_Value &tv);
tv
times out or until the semaphore
count becomes greater than 0 (at which point it is decremented).
The value of tv
is updated upon return, i.e., the caller gets
the amount of time that has elapsed while waiting to acquire the
semaphore.
int tryacquire (void);
errno
is set to
EBUSY
.
int release (void);
int release (size_t release_count);
release_count
, potentially
unblocking waiting threads.
int acquire_read (void);
acquire
and is only
here to make the ACE_Semaphore
interface consistent with the
other synchronization APIs.
int acquire_write (void);
acquire
and is only
here to make the ACE_Semaphore
interface consistent with the
other synchronization APIs.
int tryacquire_read (void);
tryacquire
and is only here to make the ACE_Semaphore
interface consistent with the other synchronization APIs.
Returns -1 on failure. If we "failed" because someone else
already had the lock, errno
is set to EBUSY
.
int tryacquire_write (void);
tryacquire
and is only here to make the ACE_Semaphore
interface consistent with the other synchronization APIs.
Returns -1 on failure. If we "failed" because someone else
already had the lock, errno
is set to EBUSY
.
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
const ACE_sema_t &lock (void) const;
void operator= (const ACE_Semaphore &);
ACE_Semaphore (const ACE_Semaphore &);