00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef ACE_BASE_THREAD_ADAPTER_H
00012 #define ACE_BASE_THREAD_ADAPTER_H
00013 #include "ace/pre.h"
00014
00015 #include "ace/OS_Log_Msg_Attributes.h"
00016
00017 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00018 # pragma once
00019 #endif
00020
00021 #include "ace/OS_Export.h"
00022
00023
00024
00025 #if defined (ACE_PSOS)
00026 extern "C" void ace_thread_adapter (unsigned long args);
00027 #else
00028 extern "C" ACE_OS_Export ACE_THR_FUNC_RETURN ace_thread_adapter (void *args);
00029 #endif
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 class ACE_OS_Export ACE_OS_Thread_Descriptor
00040 {
00041 public:
00042
00043 long flags (void) const;
00044
00045 protected:
00046
00047 ACE_OS_Thread_Descriptor (long flags = 0);
00048
00049
00050
00051
00052
00053
00054
00055 long flags_;
00056 };
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 class ACE_OS_Export ACE_Base_Thread_Adapter
00075 {
00076 public:
00077
00078 ACE_Base_Thread_Adapter (ACE_THR_FUNC user_func,
00079 void *arg,
00080 ACE_THR_C_FUNC entry_point = (ACE_THR_C_FUNC) ace_thread_adapter,
00081 ACE_OS_Thread_Descriptor *td = 0
00082 # if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
00083 , ACE_SEH_EXCEPT_HANDLER selector = 0
00084 , ACE_SEH_EXCEPT_HANDLER handler = 0
00085 # endif
00086 );
00087
00088
00089 virtual ACE_THR_FUNC_RETURN invoke (void) = 0;
00090
00091
00092
00093 ACE_THR_C_FUNC entry_point (void);
00094
00095
00096 static void close_log_msg (void);
00097
00098
00099 static void sync_log_msg (const ACE_TCHAR *prog_name);
00100
00101
00102 static ACE_OS_Thread_Descriptor *thr_desc_log_msg (void);
00103
00104 protected:
00105
00106
00107 virtual ~ACE_Base_Thread_Adapter (void);
00108
00109
00110
00111 void inherit_log_msg (void);
00112
00113 private:
00114
00115 static ACE_INIT_LOG_MSG_HOOK init_log_msg_hook_;
00116 static ACE_INHERIT_LOG_MSG_HOOK inherit_log_msg_hook_;
00117 static ACE_CLOSE_LOG_MSG_HOOK close_log_msg_hook_;
00118 static ACE_SYNC_LOG_MSG_HOOK sync_log_msg_hook_;
00119 static ACE_THR_DESC_LOG_MSG_HOOK thr_desc_log_msg_hook_;
00120
00121
00122 static void set_log_msg_hooks (ACE_INIT_LOG_MSG_HOOK init_hook,
00123 ACE_INHERIT_LOG_MSG_HOOK inherit_hook,
00124 ACE_CLOSE_LOG_MSG_HOOK close_hook,
00125 ACE_SYNC_LOG_MSG_HOOK sync_hook,
00126 ACE_THR_DESC_LOG_MSG_HOOK thr_desc);
00127
00128
00129 friend class ACE_Log_Msg;
00130
00131 protected:
00132
00133 ACE_THR_FUNC user_func_;
00134
00135
00136 void *arg_;
00137
00138
00139
00140 ACE_THR_C_FUNC entry_point_;
00141
00142
00143
00144
00145
00146
00147
00148 ACE_OS_Thread_Descriptor *thr_desc_;
00149
00150
00151 ACE_OS_Log_Msg_Attributes log_msg_attributes_;
00152
00153
00154
00155 friend class ACE_Thread_Adapter_Has_Private_Destructor;
00156 };
00157
00158 # if defined (ACE_HAS_INLINED_OSCALLS)
00159 # if defined (ACE_INLINE)
00160 # undef ACE_INLINE
00161 # endif
00162 # define ACE_INLINE inline
00163 # include "ace/Base_Thread_Adapter.inl"
00164 # endif
00165
00166 #include "ace/post.h"
00167 #endif