Wrapper for Dijkstra style general semaphores that work across processes. More...
#include <Process_Semaphore.h>

Public Member Functions | |
| ACE_Process_Semaphore (u_int count=1, const ACE_TCHAR *name=0, void *=0, int max=0x7FFFFFFF) | |
| int | remove (void) |
| int | acquire (void) |
| int | tryacquire (void) |
| int | release (void) |
| Increment the semaphore, potentially unblocking a waiting thread. | |
| int | acquire_read (void) |
| int | acquire_write (void) |
| int | tryacquire_read (void) |
| int | tryacquire_write (void) |
| int | tryacquire_write_upgrade (void) |
| void | dump (void) const |
| Dump the state of an object. | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. | |
Protected Attributes | |
| ACE_SV_Semaphore_Complex | lock_ |
| We need this to get the right semantics... | |
Wrapper for Dijkstra style general semaphores that work across processes.
Definition at line 41 of file Process_Semaphore.h.
| ACE_Process_Semaphore::ACE_Process_Semaphore | ( | u_int | count = 1, |
|
| const ACE_TCHAR * | name = 0, |
|||
| void * | arg = 0, |
|||
| int | max = 0x7FFFFFFF | |||
| ) |
Initialize the semaphore, with an initial value of count and a maximum value of max.
Definition at line 28 of file Process_Semaphore.cpp.
: lock_ (count, USYNC_PROCESS, name, arg, max) #else : lock_ (ACE_TEXT_ALWAYS_CHAR (name), ACE_SV_Semaphore_Complex::ACE_CREATE, count) #endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM */ { ACE_UNUSED_ARG (arg); ACE_UNUSED_ARG (max); // ACE_TRACE ("ACE_Process_Semaphore::ACE_Process_Semaphore"); }
| int ACE_Process_Semaphore::acquire | ( | void | ) |
Block the thread until the semaphore count becomes greater than 0, then decrement it.
Definition at line 58 of file Process_Semaphore.cpp.
| int ACE_Process_Semaphore::acquire_read | ( | void | ) |
Acquire semaphore ownership. This calls <acquire> and is only here to make the ACE_Process_Semaphore interface consistent with the other synchronization APIs.
Definition at line 21 of file Process_Semaphore.inl.
{
return this->acquire ();
}
| int ACE_Process_Semaphore::acquire_write | ( | void | ) |
Acquire semaphore ownership. This calls <acquire> and is only here to make the ACE_Process_Semaphore interface consistent with the other synchronization APIs.
Definition at line 31 of file Process_Semaphore.inl.
{
return this->acquire ();
}
| void ACE_Process_Semaphore::dump | ( | void | ) | const |
Dump the state of an object.
Definition at line 18 of file Process_Semaphore.cpp.
{
#if defined (ACE_HAS_DUMP)
// ACE_TRACE ("ACE_Process_Semaphore::dump");
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
this->lock_.dump ();
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
| int ACE_Process_Semaphore::release | ( | void | ) |
Increment the semaphore, potentially unblocking a waiting thread.
Definition at line 86 of file Process_Semaphore.cpp.
| int ACE_Process_Semaphore::remove | ( | void | ) |
Explicitly destroy the semaphore. Note that only one thread should call this method since it doesn't protect against race conditions.
Definition at line 48 of file Process_Semaphore.cpp.
| int ACE_Process_Semaphore::tryacquire | ( | void | ) |
Conditionally decrement the semaphore if count is greater than 0 (i.e., won't block). Returns -1 on failure. If we "failed" because someone else already had the lock, errno is set to EBUSY.
Definition at line 72 of file Process_Semaphore.cpp.
{
// ACE_TRACE ("ACE_Process_Semaphore::tryacquire");
#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM)
return this->lock_.tryacquire ();
#else
return this->lock_.tryacquire (0, SEM_UNDO);
#endif /* defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) */
}
| int ACE_Process_Semaphore::tryacquire_read | ( | void | ) |
Conditionally acquire semaphore (i.e., won't block). This calls <tryacquire> and is only here to make the ACE_Process_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.
Definition at line 41 of file Process_Semaphore.inl.
{
return this->tryacquire ();
}
| int ACE_Process_Semaphore::tryacquire_write | ( | void | ) |
Conditionally acquire semaphore (i.e., won't block). This calls <tryacquire> and is only here to make the ACE_Process_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.
Definition at line 51 of file Process_Semaphore.inl.
{
return this->tryacquire ();
}
| int ACE_Process_Semaphore::tryacquire_write_upgrade | ( | void | ) |
This is only here to make the ACE_Process_Semaphore interface consistent with the other synchronization APIs. Assumes the caller has already acquired the semaphore using one of the above calls, and returns 0 (success) always.
Definition at line 61 of file Process_Semaphore.inl.
{
return 0;
}
Declare the dynamic allocation hooks.
Definition at line 122 of file Process_Semaphore.h.
ACE_SV_Semaphore_Complex ACE_Process_Semaphore::lock_ [protected] |
We need this to get the right semantics...
Definition at line 129 of file Process_Semaphore.h.
1.7.0