GitHub Actions: Try MSVC builds with /std:c++17 and 20
[ACE_TAO.git] / ACE / ace / Synch_Traits.h
blob3a4c52dd1ab76891fd324acd9f45479634ca4026
1 // -*- C++ -*-
3 //==========================================================================
4 /**
5 * @file Synch_Traits.h
7 * Moved from Synch.h.
9 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
11 //==========================================================================
13 #ifndef ACE_SYNCH_TRAITS_H
14 #define ACE_SYNCH_TRAITS_H
15 #include /**/ "ace/pre.h"
17 #include /**/ "ace/config-all.h" /* Need to know threads, template settings */
18 #include "ace/Lock.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 # pragma once
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
26 // Forward decl
27 class ACE_Null_Mutex;
28 class ACE_Null_Semaphore;
29 class ACE_Null_Mutex;
30 class ACE_Thread_Mutex;
31 class ACE_Process_Mutex;
32 class ACE_Recursive_Thread_Mutex;
33 class ACE_RW_Thread_Mutex;
34 class ACE_Thread_Semaphore;
36 template <class MUTEX> class ACE_Condition;
37 typedef ACE_Condition<ACE_Null_Mutex> ACE_Null_Condition;
38 typedef ACE_Condition<ACE_Thread_Mutex> ACE_Condition_Thread_Mutex;
39 typedef ACE_Condition<ACE_Recursive_Thread_Mutex> ACE_Condition_Recursive_Thread_Mutex;
41 /**
42 * @class ACE_NULL_SYNCH
44 * @brief Implement a do nothing Synchronization wrapper that
45 * typedefs the @c ACE_Condition and @c ACE_Mutex to the
46 * @c Null* versions.
48 class ACE_Export ACE_NULL_SYNCH
50 public:
51 typedef ACE_Null_Mutex MUTEX;
52 typedef ACE_Null_Mutex NULL_MUTEX;
53 typedef ACE_Null_Mutex PROCESS_MUTEX;
54 typedef ACE_Null_Mutex RECURSIVE_MUTEX;
55 typedef ACE_Null_Mutex RW_MUTEX;
56 typedef ACE_Null_Condition CONDITION;
57 typedef ACE_Null_Condition RECURSIVE_CONDITION;
58 typedef ACE_Null_Semaphore SEMAPHORE;
59 typedef ACE_Null_Mutex NULL_SEMAPHORE;
62 #if defined (ACE_HAS_THREADS)
64 class ACE_Process_Mutex;
66 /**
67 * @class ACE_MT_SYNCH
69 * @brief Implement a default thread safe synchronization wrapper that
70 * typedefs the @c ACE_Condition and @c ACE_Mutex to the
71 * @c ACE_Condition and @c ACE_Mutex versions.
73 * @todo This should be a template, but SunC++ 4.0.1 complains about
74 * this.
76 class ACE_Export ACE_MT_SYNCH
78 public:
79 typedef ACE_Thread_Mutex MUTEX;
80 typedef ACE_Null_Mutex NULL_MUTEX;
81 typedef ACE_Process_Mutex PROCESS_MUTEX;
82 typedef ACE_Recursive_Thread_Mutex RECURSIVE_MUTEX;
83 typedef ACE_RW_Thread_Mutex RW_MUTEX;
84 typedef ACE_Condition_Thread_Mutex CONDITION;
85 typedef ACE_Condition_Recursive_Thread_Mutex RECURSIVE_CONDITION;
86 typedef ACE_Thread_Semaphore SEMAPHORE;
87 typedef ACE_Null_Semaphore NULL_SEMAPHORE;
90 #endif /* ACE_HAS_THREADS */
92 #define ACE_SYNCH_MUTEX ACE_SYNCH::MUTEX
93 #define ACE_SYNCH_NULL_MUTEX ACE_SYNCH::NULL_MUTEX
94 #define ACE_SYNCH_RECURSIVE_MUTEX ACE_SYNCH::RECURSIVE_MUTEX
95 #define ACE_SYNCH_RW_MUTEX ACE_SYNCH::RW_MUTEX
96 #define ACE_SYNCH_CONDITION ACE_SYNCH::CONDITION
97 #define ACE_SYNCH_RECURSIVE_CONDITION ACE_SYNCH::RECURSIVE_CONDITION
98 #define ACE_SYNCH_NULL_SEMAPHORE ACE_SYNCH::NULL_SEMAPHORE
99 #define ACE_SYNCH_SEMAPHORE ACE_SYNCH::SEMAPHORE
101 // These are available on *all* platforms
102 #define ACE_SYNCH_PROCESS_SEMAPHORE ACE_Process_Semaphore
103 #define ACE_SYNCH_PROCESS_MUTEX ACE_Process_Mutex
105 #if defined (ACE_HAS_THREADS)
106 #define ACE_SYNCH ACE_MT_SYNCH
107 #else /* ACE_HAS_THREADS */
108 #define ACE_SYNCH ACE_NULL_SYNCH
109 #endif /* ACE_HAS_THREADS */
111 ACE_END_VERSIONED_NAMESPACE_DECL
113 #include /**/ "ace/post.h"
114 #endif /* ACE_SYNCH_TRAITS_H */