Synch_Traits.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //==========================================================================
00004 /**
00005  *  @file    Synch_Traits.h
00006  *
00007  *  Synch_Traits.h,v 4.5 2005/10/28 16:14:56 ossama Exp
00008  *
00009  *   Moved from Synch.h.
00010  *
00011  *  @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
00012  */
00013 //==========================================================================
00014 
00015 #ifndef ACE_SYNCH_TRAITS_H
00016 #define ACE_SYNCH_TRAITS_H
00017 #include /**/ "ace/pre.h"
00018 
00019 #include "ace/config-all.h"    /* Need to know threads, template settings */
00020 #include "ace/Lock.h"
00021 
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 # pragma once
00024 #endif /* ACE_LACKS_PRAGMA_ONCE */
00025 
00026 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00027 
00028 // Forward decl
00029 class ACE_Null_Mutex;
00030 class ACE_Null_Condition;
00031 class ACE_Null_Semaphore;
00032 class ACE_Null_Mutex;
00033 class ACE_Thread_Mutex;
00034 class ACE_Process_Mutex;
00035 class ACE_Recursive_Thread_Mutex;
00036 class ACE_RW_Thread_Mutex;
00037 class ACE_Condition_Thread_Mutex;
00038 class ACE_Condition_Recursive_Thread_Mutex;
00039 class ACE_Thread_Semaphore;
00040 
00041 #if defined (ACE_HAS_TEMPLATE_TYPEDEFS)
00042 
00043 /**
00044  * @class ACE_NULL_SYNCH
00045  *
00046  * @brief Implement a do nothing Synchronization wrapper that
00047  *        typedefs the @c ACE_Condition and @c ACE_Mutex to the
00048  *        @c Null* versions.
00049  */
00050 class ACE_Export ACE_NULL_SYNCH
00051 {
00052 public:
00053   typedef ACE_Null_Mutex MUTEX;
00054   typedef ACE_Null_Mutex NULL_MUTEX;
00055   typedef ACE_Null_Mutex PROCESS_MUTEX;
00056   typedef ACE_Null_Mutex RECURSIVE_MUTEX;
00057   typedef ACE_Null_Mutex RW_MUTEX;
00058   typedef ACE_Null_Condition CONDITION;
00059   typedef ACE_Null_Condition RECURSIVE_CONDITION;
00060   typedef ACE_Null_Semaphore SEMAPHORE;
00061   typedef ACE_Null_Mutex NULL_SEMAPHORE;
00062 };
00063 
00064 #if defined (ACE_HAS_THREADS)
00065 
00066 class ACE_Process_Mutex;
00067 class ACE_Condition_Recursive_Thread_Mutex;
00068 
00069 /**
00070  * @class ACE_MT_SYNCH
00071  *
00072  * @brief Implement a default thread safe synchronization wrapper that
00073  *        typedefs the @c ACE_Condition and @c ACE_Mutex to the
00074  * @c ACE_Condition and @c ACE_Mutex versions.
00075  *
00076  * @todo This should be a template, but SunC++ 4.0.1 complains about
00077  *       this.
00078  */
00079 class ACE_Export ACE_MT_SYNCH
00080 {
00081 public:
00082   typedef ACE_Thread_Mutex MUTEX;
00083   typedef ACE_Null_Mutex NULL_MUTEX;
00084   typedef ACE_Process_Mutex PROCESS_MUTEX;
00085   typedef ACE_Recursive_Thread_Mutex RECURSIVE_MUTEX;
00086   typedef ACE_RW_Thread_Mutex RW_MUTEX;
00087   typedef ACE_Condition_Thread_Mutex CONDITION;
00088   typedef ACE_Condition_Recursive_Thread_Mutex RECURSIVE_CONDITION;
00089   typedef ACE_Thread_Semaphore SEMAPHORE;
00090   typedef ACE_Null_Semaphore NULL_SEMAPHORE;
00091 };
00092 
00093 #endif /* ACE_HAS_THREADS */
00094 
00095 #define ACE_SYNCH_MUTEX ACE_SYNCH::MUTEX
00096 #define ACE_SYNCH_NULL_MUTEX ACE_SYNCH::NULL_MUTEX
00097 #define ACE_SYNCH_RECURSIVE_MUTEX ACE_SYNCH::RECURSIVE_MUTEX
00098 #define ACE_SYNCH_RW_MUTEX ACE_SYNCH::RW_MUTEX
00099 #define ACE_SYNCH_CONDITION ACE_SYNCH::CONDITION
00100 #define ACE_SYNCH_RECURSIVE_CONDITION ACE_SYNCH::RECURSIVE_CONDITION
00101 #define ACE_SYNCH_NULL_SEMAPHORE ACE_SYNCH::NULL_SEMAPHORE
00102 #define ACE_SYNCH_SEMAPHORE ACE_SYNCH::SEMAPHORE
00103 
00104 #else /* !ACE_HAS_TEMPLATE_TYPEDEFS */
00105 
00106 #if defined (ACE_HAS_OPTIMIZED_MESSAGE_QUEUE)
00107 #define ACE_NULL_SYNCH ACE_Null_Mutex, ACE_Null_Condition, ACE_Null_Mutex
00108 #define ACE_MT_SYNCH ACE_Thread_Mutex, ACE_Condition_Thread_Mutex, ACE_Thread_Semaphore
00109 #else
00110 #define ACE_NULL_SYNCH ACE_Null_Mutex, ACE_Null_Condition
00111 #define ACE_MT_SYNCH ACE_Thread_Mutex, ACE_Condition_Thread_Mutex
00112 #endif /* ACE_HAS_OPTIMIZED_MESSAGE_QUEUE */
00113 
00114 #if defined (ACE_HAS_THREADS)
00115 
00116 #define ACE_SYNCH_MUTEX ACE_Thread_Mutex
00117 #define ACE_SYNCH_NULL_MUTEX  ACE_Null_Mutex
00118 #define ACE_SYNCH_RECURSIVE_MUTEX ACE_Recursive_Thread_Mutex
00119 #define ACE_SYNCH_RW_MUTEX ACE_RW_Thread_Mutex
00120 #define ACE_SYNCH_CONDITION ACE_Condition_Thread_Mutex
00121 #define ACE_SYNCH_RECURSIVE_CONDITION ACE_Condition_Recursive_Thread_Mutex
00122 #define ACE_SYNCH_SEMAPHORE ACE_Thread_Semaphore
00123 #define ACE_SYNCH_NULL_SEMAPHORE  ACE_Null_Semaphore
00124 
00125 #else /* ACE_HAS_THREADS */
00126 
00127 #define ACE_SYNCH_MUTEX ACE_Null_Mutex
00128 #define ACE_SYNCH_NULL_MUTEX ACE_Null_Mutex
00129 #define ACE_SYNCH_RECURSIVE_MUTEX ACE_Null_Mutex
00130 #define ACE_SYNCH_RW_MUTEX ACE_Null_Mutex
00131 #define ACE_SYNCH_CONDITION ACE_Null_Condition
00132 #define ACE_SYNCH_RECURSIVE_CONDITION ACE_Null_Condition
00133 #define ACE_SYNCH_SEMAPHORE ACE_Null_Semaphore
00134 #define ACE_SYNCH_NULL_SEMAPHORE ACE_Null_Mutex
00135 
00136 #endif /* ACE_HAS_THREADS */
00137 #endif /* ACE_HAS_TEMPLATE_TYPEDEFS */
00138 
00139 // These are available on *all* platforms
00140 #define ACE_SYNCH_PROCESS_SEMAPHORE ACE_Process_Semaphore
00141 #define ACE_SYNCH_PROCESS_MUTEX  ACE_Process_Mutex
00142 
00143 #if defined (ACE_HAS_THREADS)
00144 #define ACE_SYNCH ACE_MT_SYNCH
00145 #else /* ACE_HAS_THREADS */
00146 #define ACE_SYNCH ACE_NULL_SYNCH
00147 #endif /* ACE_HAS_THREADS */
00148 
00149 ACE_END_VERSIONED_NAMESPACE_DECL
00150 
00151 #include /**/ "ace/post.h"
00152 #endif /* ACE_SYNCH_TRAITS_H */

Generated on Thu Nov 9 09:42:06 2006 for ACE by doxygen 1.3.6