#include <Base_Thread_Adapter.h>
Inheritance diagram for ACE_Base_Thread_Adapter:
Public Member Functions | |
virtual | ~ACE_Base_Thread_Adapter (void) |
virtual ACE_THR_FUNC_RETURN | invoke (void)=0 |
Virtual method invoked by the thread entry point. | |
ACE_THR_C_FUNC | entry_point (void) |
Static Public Member Functions | |
static void | close_log_msg (void) |
Invoke the close_log_msg_hook, if it is present. | |
static void | sync_log_msg (const ACE_TCHAR *prog_name) |
Invoke the sync_log_msg_hook, if it is present. | |
static ACE_OS_Thread_Descriptor * | thr_desc_log_msg (void) |
Invoke the thr_desc_log_msg_hook, if it is present. | |
Protected Member Functions | |
ACE_Base_Thread_Adapter (ACE_THR_FUNC user_func, void *arg, ACE_THR_C_FUNC entry_point=(ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, ACE_OS_Thread_Descriptor *td=0) | |
Constructor. | |
void | inherit_log_msg (void) |
Protected Attributes | |
ACE_THR_FUNC | user_func_ |
Thread startup function passed in by the user (C++ linkage). | |
void * | arg_ |
Argument to thread startup function. | |
ACE_THR_C_FUNC | entry_point_ |
ACE_OS_Thread_Descriptor * | thr_desc_ |
ACE_OS_Log_Msg_Attributes | log_msg_attributes_ |
The ACE_Log_Msg attributes. | |
ACE_Service_Gestalt *const | ctx_ |
That is usefull for gprof, define itimerval. | |
Static Private Member Functions | |
static void | set_log_msg_hooks (ACE_INIT_LOG_MSG_HOOK init_hook, ACE_INHERIT_LOG_MSG_HOOK inherit_hook, ACE_CLOSE_LOG_MSG_HOOK close_hook, ACE_SYNC_LOG_MSG_HOOK sync_hook, ACE_THR_DESC_LOG_MSG_HOOK thr_desc) |
Set the Log_Msg hooks. | |
Static Private Attributes | |
static ACE_INIT_LOG_MSG_HOOK | init_log_msg_hook_ = 0 |
The hooks to inherit and cleanup the Log_Msg attributes. | |
static ACE_INHERIT_LOG_MSG_HOOK | inherit_log_msg_hook_ = 0 |
static ACE_CLOSE_LOG_MSG_HOOK | close_log_msg_hook_ = 0 |
static ACE_SYNC_LOG_MSG_HOOK | sync_log_msg_hook_ = 0 |
static ACE_THR_DESC_LOG_MSG_HOOK | thr_desc_log_msg_hook_ = 0 |
Friends | |
class | ACE_Log_Msg |
Allow the ACE_Log_Msg class to set its hooks. |
Converts a C++ function into a function that can be called from a thread creation routine (e.g., pthread_create() or _beginthreadex()) that expects an extern "C" entry point. This class also makes it possible to transparently provide hooks to register a thread with an ACE_Thread_Manager. This class is used in ACE_OS::thr_create(). In general, the thread that creates an object of this class is different from the thread that calls invoke()
on this object. Therefore, the invoke()
method is responsible for deleting itself.
Definition at line 91 of file Base_Thread_Adapter.h.
ACE_Base_Thread_Adapter::~ACE_Base_Thread_Adapter | ( | void | ) | [virtual] |
ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter | ( | ACE_THR_FUNC | user_func, | |
void * | arg, | |||
ACE_THR_C_FUNC | entry_point = (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME , |
|||
ACE_OS_Thread_Descriptor * | td = 0 | |||
) | [protected] |
Constructor.
Definition at line 27 of file Base_Thread_Adapter.cpp.
References ACE_OS_TRACE, and log_msg_attributes_.
00037 : user_func_ (user_func) 00038 , arg_ (arg) 00039 , entry_point_ (entry_point) 00040 , thr_desc_ (td) 00041 , ctx_ (ACE_Service_Config::current()) 00042 { 00043 ACE_OS_TRACE ("ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter"); 00044 00045 if (ACE_Base_Thread_Adapter::init_log_msg_hook_ != 0) 00046 (*ACE_Base_Thread_Adapter::init_log_msg_hook_) ( 00047 this->log_msg_attributes_ 00048 # if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) 00049 , selector 00050 , handler 00051 # endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ 00052 ); 00053 #ifdef ACE_USES_GPROF 00054 getitimer (ITIMER_PROF, &itimer_); 00055 #endif // ACE_USES_GPROF 00056 }
void ACE_Base_Thread_Adapter::close_log_msg | ( | void | ) | [static] |
Invoke the close_log_msg_hook, if it is present.
Definition at line 77 of file Base_Thread_Adapter.cpp.
Referenced by ACE_OS::cleanup_tss().
00078 { 00079 if (ACE_Base_Thread_Adapter::close_log_msg_hook_ != 0) 00080 (*ACE_Base_Thread_Adapter::close_log_msg_hook_) (); 00081 }
ACE_INLINE ACE_THR_C_FUNC ACE_Base_Thread_Adapter::entry_point | ( | void | ) |
Accessor for the C entry point function to the OS thread creation routine.
Definition at line 35 of file Base_Thread_Adapter.inl.
References entry_point_.
Referenced by ACE_OS::thr_create().
00036 { 00037 return this->entry_point_; 00038 }
void ACE_Base_Thread_Adapter::inherit_log_msg | ( | void | ) | [protected] |
Inherit the logging features if the parent thread has an ACE_Log_Msg.
Definition at line 63 of file Base_Thread_Adapter.cpp.
References ACE_Service_Config::current(), log_msg_attributes_, and thr_desc_.
Referenced by ACE_Thread_Adapter::invoke(), and ACE_OS_Thread_Adapter::invoke().
00064 { 00065 if (ACE_Base_Thread_Adapter::inherit_log_msg_hook_ != 0) 00066 (*ACE_Base_Thread_Adapter::inherit_log_msg_hook_)( 00067 this->thr_desc_, 00068 this->log_msg_attributes_); 00069 00070 // Initialize the proper configuration context for the new thread 00071 // Placed here since inherit_log_msg() gets called from any of our 00072 // descendants (before self-destructing) 00073 ACE_Service_Config::current (this->ctx_); 00074 }
virtual ACE_THR_FUNC_RETURN ACE_Base_Thread_Adapter::invoke | ( | void | ) | [pure virtual] |
Virtual method invoked by the thread entry point.
Implemented in ACE_OS_Thread_Adapter, and ACE_Thread_Adapter.
ACE_INLINE void ACE_Base_Thread_Adapter::set_log_msg_hooks | ( | ACE_INIT_LOG_MSG_HOOK | init_hook, | |
ACE_INHERIT_LOG_MSG_HOOK | inherit_hook, | |||
ACE_CLOSE_LOG_MSG_HOOK | close_hook, | |||
ACE_SYNC_LOG_MSG_HOOK | sync_hook, | |||
ACE_THR_DESC_LOG_MSG_HOOK | thr_desc | |||
) | [static, private] |
Set the Log_Msg hooks.
Definition at line 20 of file Base_Thread_Adapter.inl.
References close_log_msg_hook_, inherit_log_msg_hook_, init_log_msg_hook_, sync_log_msg_hook_, and thr_desc_log_msg_hook_.
Referenced by ACE_Log_Msg::ACE_Log_Msg().
00026 { 00027 ACE_Base_Thread_Adapter::init_log_msg_hook_ = init_hook; 00028 ACE_Base_Thread_Adapter::inherit_log_msg_hook_ = inherit_hook; 00029 ACE_Base_Thread_Adapter::close_log_msg_hook_ = close_hook; 00030 ACE_Base_Thread_Adapter::sync_log_msg_hook_ = sync_hook; 00031 ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ = thr_desc_hook; 00032 }
void ACE_Base_Thread_Adapter::sync_log_msg | ( | const ACE_TCHAR * | prog_name | ) | [static] |
Invoke the sync_log_msg_hook, if it is present.
Definition at line 84 of file Base_Thread_Adapter.cpp.
Referenced by ACE_OS::fork().
00085 { 00086 if (ACE_Base_Thread_Adapter::sync_log_msg_hook_ != 0) 00087 (*ACE_Base_Thread_Adapter::sync_log_msg_hook_) (prg); 00088 }
ACE_OS_Thread_Descriptor * ACE_Base_Thread_Adapter::thr_desc_log_msg | ( | void | ) | [static] |
Invoke the thr_desc_log_msg_hook, if it is present.
Definition at line 91 of file Base_Thread_Adapter.cpp.
Referenced by ACE_OS::thr_exit().
00092 { 00093 if (ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ != 0) 00094 return (*ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_) (); 00095 return 0; 00096 }
friend class ACE_Log_Msg [friend] |
void* ACE_Base_Thread_Adapter::arg_ [protected] |
Argument to thread startup function.
Definition at line 157 of file Base_Thread_Adapter.h.
Referenced by ACE_OS_Thread_Adapter::invoke(), and ACE_Thread_Adapter::invoke_i().
ACE_CLOSE_LOG_MSG_HOOK ACE_Base_Thread_Adapter::close_log_msg_hook_ = 0 [static, private] |
ACE_Service_Gestalt* const ACE_Base_Thread_Adapter::ctx_ [protected] |
That is usefull for gprof, define itimerval.
Keep a reference to the configuration context that spawns the thread so the child can inherit it.
Definition at line 181 of file Base_Thread_Adapter.h.
ACE_THR_C_FUNC ACE_Base_Thread_Adapter::entry_point_ [protected] |
Entry point to the underlying OS thread creation call (C linkage).
Definition at line 161 of file Base_Thread_Adapter.h.
Referenced by entry_point().
ACE_INHERIT_LOG_MSG_HOOK ACE_Base_Thread_Adapter::inherit_log_msg_hook_ = 0 [static, private] |
ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INIT_LOG_MSG_HOOK ACE_Base_Thread_Adapter::init_log_msg_hook_ = 0 [static, private] |
The hooks to inherit and cleanup the Log_Msg attributes.
Definition at line 136 of file Base_Thread_Adapter.h.
Referenced by set_log_msg_hooks().
The ACE_Log_Msg attributes.
Definition at line 172 of file Base_Thread_Adapter.h.
Referenced by ACE_Base_Thread_Adapter(), and inherit_log_msg().
ACE_SYNC_LOG_MSG_HOOK ACE_Base_Thread_Adapter::sync_log_msg_hook_ = 0 [static, private] |
Optional thread descriptor. Passing this pointer in will force the spawned thread to cache this location in <Log_Msg> and wait until <Thread_Manager> fills in all information in thread descriptor.
Definition at line 169 of file Base_Thread_Adapter.h.
Referenced by inherit_log_msg(), and ACE_Thread_Adapter::invoke_i().
ACE_THR_DESC_LOG_MSG_HOOK ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ = 0 [static, private] |
ACE_THR_FUNC ACE_Base_Thread_Adapter::user_func_ [protected] |
Thread startup function passed in by the user (C++ linkage).
Definition at line 154 of file Base_Thread_Adapter.h.
Referenced by ACE_OS_Thread_Adapter::invoke(), and ACE_Thread_Adapter::invoke_i().