Correct feature names
[ACE_TAO.git] / ACE / ace / Thread_Semaphore.h
blobc59e25ba97c7d1a5c64028e8c30e12065c0b9afa
1 // -*- C++ -*-
3 //==========================================================================
4 /**
5 * @file Thread_Semaphore.h
7 * Moved from Synch.h.
9 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
11 //==========================================================================
13 #ifndef ACE_THREAD_SEMAPHORE_H
14 #define ACE_THREAD_SEMAPHORE_H
15 #include /**/ "ace/pre.h"
17 #include /**/ "ace/ACE_export.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 # pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #if !defined (ACE_HAS_THREADS)
24 # include "ace/Null_Semaphore.h"
25 #else /* ACE_HAS_THREADS */
26 // ACE platform supports some form of threading.
28 #include "ace/Semaphore.h"
30 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
32 /**
33 * @class ACE_Thread_Semaphore
35 * @brief Wrapper for Dijkstra style general semaphores that work
36 * only within one process.
38 class ACE_Export ACE_Thread_Semaphore : public ACE_Semaphore
40 public:
41 /// Initialize the semaphore, with an initial value of @a count,
42 /// maximum value of @a max, and unlocked by default.
43 ACE_Thread_Semaphore (unsigned int count = 1, // By default make this unlocked.
44 const ACE_TCHAR *name = 0,
45 void * = 0,
46 int max = 0x7FFFFFFF);
48 /// Default destructor.
49 ~ACE_Thread_Semaphore (void);
51 /// Dump the state of an object.
52 void dump (void) const;
54 /// Declare the dynamic allocation hooks.
55 ACE_ALLOC_HOOK_DECLARE;
58 /*****************************************************************************/
60 template <class T> class ACE_Malloc_Lock_Adapter_T;
62 /**
63 * @brief Template specialization of ACE_Malloc_Lock_Adapter_T for
64 * ACE_Thread_Semaphore.
66 * This is needed since the ctor for ACE_Thread_Semaphore doesn't match
67 * the standard form used by other lock strategy classes.
69 template<>
70 class ACE_Export ACE_Malloc_Lock_Adapter_T<ACE_Thread_Semaphore>
72 public:
73 ACE_Thread_Semaphore * operator () (const ACE_TCHAR *name);
76 ACE_END_VERSIONED_NAMESPACE_DECL
78 #if defined (__ACE_INLINE__)
79 #include "ace/Thread_Semaphore.inl"
80 #endif /* __ACE_INLINE__ */
82 #endif /* !ACE_HAS_THREADS */
84 #include /**/ "ace/post.h"
85 #endif /* ACE_THREAD_SEMAPHORE_H */