summaryrefslogtreecommitdiff
path: root/ace/Thread_Semaphore.h
diff options
context:
space:
mode:
authordhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-08-04 03:53:54 +0000
committerdhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-08-04 03:53:54 +0000
commit5bef9626a3ab5e70fe002f3237761150a5e59787 (patch)
tree12103be26b2e9b0cd1869d7fd72a1f8a8ec362e6 /ace/Thread_Semaphore.h
parent4ca7b649a73214d4cbbac1e739436bf60a370f83 (diff)
downloadATCD-5bef9626a3ab5e70fe002f3237761150a5e59787.tar.gz
ChangeLogTag:Mon Aug 4 03:26:30 UTC 2003 Don Hinton <dhinton@dresystems.com>
Diffstat (limited to 'ace/Thread_Semaphore.h')
-rw-r--r--ace/Thread_Semaphore.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/ace/Thread_Semaphore.h b/ace/Thread_Semaphore.h
new file mode 100644
index 00000000000..e39ec55ad14
--- /dev/null
+++ b/ace/Thread_Semaphore.h
@@ -0,0 +1,65 @@
+// -*- C++ -*-
+
+//==========================================================================
+/**
+ * @file Thread_Semaphore.h
+ *
+ * $Id$
+ *
+ * Moved from Synch.h.
+ *
+ * @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
+ */
+//==========================================================================
+
+#ifndef ACE_THREAD_SEMAPHORE_H
+#define ACE_THREAD_SEMAPHORE_H
+#include /**/ "ace/pre.h"
+
+#include "ace/ACE_export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if !defined (ACE_HAS_THREADS)
+# include "ace/Null_Semaphore.h"
+#else /* ACE_HAS_THREADS */
+// ACE platform supports some form of threading.
+
+#include "ace/Semaphore.h"
+
+/**
+ * @class ACE_Thread_Semaphore
+ *
+ * @brief Wrapper for Dijkstra style general semaphores that work
+ * only within one process.
+ */
+class ACE_Export ACE_Thread_Semaphore : public ACE_Semaphore
+{
+public:
+ /// Initialize the semaphore, with an initial value of <count>,
+ /// maximum value of <max>, and unlocked by default.
+ ACE_Thread_Semaphore (unsigned int count = 1, // By default make this unlocked.
+ const ACE_TCHAR *name = 0,
+ void * = 0,
+ int max = 0x7FFFFFFF);
+
+ /// Default dtor.
+ ~ACE_Thread_Semaphore (void);
+
+ /// Dump the state of an object.
+ void dump (void) const;
+
+ /// Declare the dynamic allocation hooks.
+ ACE_ALLOC_HOOK_DECLARE;
+};
+
+#if defined (__ACE_INLINE__)
+#include "ace/Thread_Semaphore.inl"
+#endif /* __ACE_INLINE__ */
+
+#endif /* !ACE_HAS_THREADS */
+
+#include /**/ "ace/post.h"
+#endif /* ACE_THREAD_SEMAPHORE_H */