#include <Process_Semaphore.h>
Collaboration diagram for ACE_Process_Semaphore:

Public Methods | |
| ACE_Process_Semaphore (u_int count=1, const ACE_TCHAR *name=0, void *=0, int max=0x7FFFFFFF) | |
| Initialize the semaphore, with an initial value of <count> and a maximum value of <max>. More... | |
| ~ACE_Process_Semaphore (void) | |
| int | remove (void) |
| int | acquire (void) |
| Block the thread until the semaphore count becomes greater than 0, then decrement it. More... | |
| int | tryacquire (void) |
| int | release (void) |
| Increment the semaphore, potentially unblocking a waiting thread. More... | |
| int | acquire_read (void) |
| int | acquire_write (void) |
| int | tryacquire_read (void) |
| int | tryacquire_write (void) |
| int | tryacquire_write_upgrade (void) |
| const ACE_sema_t & | lock (void) const |
| Return the underlying lock. More... | |
| void | dump (void) const |
| Dump the state of an object. More... | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. More... | |
Protected Attributes | |
| ACE_Semaphore | lock_ |
Definition at line 38 of file Process_Semaphore.h.
|
||||||||||||||||||||
|
Initialize the semaphore, with an initial value of <count> and a maximum value of <max>.
Definition at line 22 of file Process_Semaphore.cpp. References ACE_SV_Semaphore_Complex::ACE_CREATE, and ACE_TCHAR.
00027 : lock_ (count, USYNC_PROCESS, name, arg, max) 00028 #else 00029 : lock_ (name, ACE_SV_Semaphore_Complex::ACE_CREATE, count) 00030 #endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */ 00031 { 00032 arg = arg; 00033 max = max; 00034 // ACE_TRACE ("ACE_Process_Semaphore::ACE_Process_Semaphore"); 00035 } |
|
|
This method is a no-op, i.e., it doesn't remove the semaphore. If you want to remove the semaphore, you must call the <remove> method explicitly. Definition at line 37 of file Process_Semaphore.cpp.
00038 {
00039 // ACE_TRACE ("ACE_Process_Semaphore::~ACE_Process_Semaphore");
00040 }
|
|
|
Block the thread until the semaphore count becomes greater than 0, then decrement it.
Definition at line 55 of file Process_Semaphore.cpp. References ACE_Semaphore::acquire, and lock_. Referenced by acquire_read, and acquire_write.
|
|
|
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 18 of file Process_Semaphore.inl. References acquire.
00019 {
00020 return this->acquire ();
00021 }
|
|
|
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 28 of file Process_Semaphore.inl. References acquire.
00029 {
00030 return this->acquire ();
00031 }
|
|
|
Dump the state of an object.
Definition at line 14 of file Process_Semaphore.cpp. References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_Semaphore::dump, LM_DEBUG, and lock_.
00015 {
00016 // ACE_TRACE ("ACE_Process_Semaphore::dump");
00017 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00018 this->lock_.dump ();
00019 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00020 }
|
|
|
Return the underlying lock.
|
|
|
Increment the semaphore, potentially unblocking a waiting thread.
Definition at line 75 of file Process_Semaphore.cpp. References lock_, and ACE_Semaphore::release.
|
|
|
Explicitly destroy the semaphore. Note that only one thread should call this method since it doesn't protect against race conditions. Definition at line 45 of file Process_Semaphore.cpp. References lock_, and ACE_Semaphore::remove.
|
|
|
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 65 of file Process_Semaphore.cpp. References lock_, and ACE_Semaphore::tryacquire. Referenced by tryacquire_read, and tryacquire_write.
00066 {
00067 // ACE_TRACE ("ACE_Process_Semaphore::tryacquire");
00068 return this->lock_.tryacquire ();
00069 }
|
|
|
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 38 of file Process_Semaphore.inl. References tryacquire.
00039 {
00040 return this->tryacquire ();
00041 }
|
|
|
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 48 of file Process_Semaphore.inl. References tryacquire.
00049 {
00050 return this->tryacquire ();
00051 }
|
|
|
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 58 of file Process_Semaphore.inl.
00059 {
00060 return 0;
00061 }
|
|
|
Declare the dynamic allocation hooks.
Definition at line 126 of file Process_Semaphore.h. |
|
|
Definition at line 130 of file Process_Semaphore.h. Referenced by acquire, dump, release, remove, and tryacquire. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002