summaryrefslogtreecommitdiff
path: root/ace/SV_Semaphore_Simple.cpp
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1996-12-02 02:31:08 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1996-12-02 02:31:08 +0000
commit09593654ece6c713b2690f7dd5cc0cc42f9ff1bf (patch)
treed3c213e139b90e270be9a81875818cfa5a701ed4 /ace/SV_Semaphore_Simple.cpp
parent12d1056218c5f7f7ed7664da05d9ea4faaaf5b86 (diff)
downloadATCD-09593654ece6c713b2690f7dd5cc0cc42f9ff1bf.tar.gz
hello
Diffstat (limited to 'ace/SV_Semaphore_Simple.cpp')
-rw-r--r--ace/SV_Semaphore_Simple.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/ace/SV_Semaphore_Simple.cpp b/ace/SV_Semaphore_Simple.cpp
index bc4e92787d8..e593d4cb36b 100644
--- a/ace/SV_Semaphore_Simple.cpp
+++ b/ace/SV_Semaphore_Simple.cpp
@@ -154,8 +154,15 @@ ACE_SV_Semaphore_Simple::open (const char *name,
int perms)
{
ACE_TRACE ("ACE_SV_Semaphore_Simple::open");
- return this->open (this->name_2_key (name),
- flags, initial_value, n, perms);
+
+ key_t key;
+
+ if (name == 0)
+ key = ACE_DEFAULT_SEM_KEY;
+ else
+ key = this->name_2_key (name);
+
+ return this->open (key, flags, initial_value, n, perms);
}
ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (const char *name,
@@ -176,3 +183,23 @@ ACE_SV_Semaphore_Simple::~ACE_SV_Semaphore_Simple (void)
this->close ();
}
+ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (void)
+{
+ ACE_TRACE ("ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple");
+ this->init ();
+}
+
+// Remove all SV_Semaphores associated with a particular key. This
+// call is intended to be called from a server, for example, when it
+// is being shut down, as we do an IPC_RMID on the ACE_SV_Semaphore,
+// regardless of whether other processes may be using it or not. Most
+// other processes should use close() below.
+
+int
+ACE_SV_Semaphore_Simple::remove (void) const
+{
+ ACE_TRACE ("ACE_SV_Semaphore_Simple::remove");
+ int result = this->control (IPC_RMID);
+ ((ACE_SV_Semaphore_Simple *) this)->init ();
+ return result;
+}