NAME
ACE_Semaphore -
Wrapper for Dijkstra style general semaphores.
SYNOPSIS
#include <ace/Synch.h>
class ACE_Semaphore
{
public:
ACE_Semaphore (
u_int count,
int type = USYNC_THREAD,
LPCTSTR name = 0,
void * = 0,
int max = 0x7fffffff
);
~ACE_Semaphore (void);
int remove (void);
int acquire (void);
int tryacquire (void);
int release (void);
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
const ACE_sema_t &lock (void) const;
private:
ACE_sema_t semaphore_;
inline void operator= (const ACE_Semaphore &);
inline ACE_Semaphore (const ACE_Semaphore &);
};
DESCRIPTION
Wrappers for various synchronization routines.
Initialization and termination.
ACE_Semaphore (
u_int count,
int type = USYNC_THREAD,
LPCTSTR name = 0,
void * = 0,
int max = 0x7fffffff
);
Initialize the semaphore, with default value of "count".
~ACE_Semaphore (void);
Implicitly destroy the semaphore.
int remove (void);
Explicitly destroy the semaphore.
int acquire (void);
Block the thread until the semaphore count becomes
greater than 0, then decrement it.
int tryacquire (void);
Conditionally decrement the semaphore if count is greater
than 0 (i.e., won't block).
int release (void);
Increment the semaphore, potentially unblocking
a waiting thread.
void dump (void) const;
Dump the state of an object.
ACE_ALLOC_HOOK_DECLARE;
Declare the dynamic allocation hooks.
const ACE_sema_t &lock (void) const;
Return the underlying lock.
Prevent assignment and initialization.
inline void operator= (const ACE_Semaphore &);
inline ACE_Semaphore (const ACE_Semaphore &);
AUTHOR
Doug Schmidt
LIBRARY
ace