Base class for all the Thread_Adapters. More...
#include <Base_Thread_Adapter.h>
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_ |
The hooks to inherit and cleanup the Log_Msg attributes. | |
static ACE_INHERIT_LOG_MSG_HOOK | inherit_log_msg_hook_ |
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. |
Base class for all the Thread_Adapters.
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] |
Definition at line 58 of file Base_Thread_Adapter.cpp.
{ }
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.
: user_func_ (user_func) , arg_ (arg) , entry_point_ (entry_point) , thr_desc_ (td) , ctx_ (ACE_Service_Config::current()) { ACE_OS_TRACE ("ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter"); if (ACE_Base_Thread_Adapter::init_log_msg_hook_ != 0) (*ACE_Base_Thread_Adapter::init_log_msg_hook_) ( this->log_msg_attributes_ # if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) , selector , handler # endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ ); #ifdef ACE_USES_GPROF getitimer (ITIMER_PROF, &itimer_); #endif // ACE_USES_GPROF }
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.
{ if (ACE_Base_Thread_Adapter::close_log_msg_hook_ != 0) (*ACE_Base_Thread_Adapter::close_log_msg_hook_) (); }
ACE_THR_C_FUNC ACE_Base_Thread_Adapter::entry_point | ( | void | ) | [inline] |
Accessor for the C entry point function to the OS thread creation routine.
Definition at line 35 of file Base_Thread_Adapter.inl.
{ return this->entry_point_; }
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.
{ if (ACE_Base_Thread_Adapter::inherit_log_msg_hook_ != 0) (*ACE_Base_Thread_Adapter::inherit_log_msg_hook_)( this->thr_desc_, this->log_msg_attributes_); // Initialize the proper configuration context for the new thread // Placed here since inherit_log_msg() gets called from any of our // descendants (before self-destructing) ACE_Service_Config::current (this->ctx_); }
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.
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 | |||
) | [inline, static, private] |
Set the Log_Msg hooks.
Definition at line 20 of file Base_Thread_Adapter.inl.
{ ACE_Base_Thread_Adapter::init_log_msg_hook_ = init_hook; ACE_Base_Thread_Adapter::inherit_log_msg_hook_ = inherit_hook; ACE_Base_Thread_Adapter::close_log_msg_hook_ = close_hook; ACE_Base_Thread_Adapter::sync_log_msg_hook_ = sync_hook; ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ = thr_desc_hook; }
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.
{ if (ACE_Base_Thread_Adapter::sync_log_msg_hook_ != 0) (*ACE_Base_Thread_Adapter::sync_log_msg_hook_) (prg); }
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.
{ if (ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ != 0) return (*ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_) (); return 0; }
friend class ACE_Log_Msg [friend] |
Allow the ACE_Log_Msg class to set its hooks.
Definition at line 150 of file Base_Thread_Adapter.h.
void* ACE_Base_Thread_Adapter::arg_ [protected] |
Argument to thread startup function.
Definition at line 157 of file Base_Thread_Adapter.h.
ACE_CLOSE_LOG_MSG_HOOK ACE_Base_Thread_Adapter::close_log_msg_hook_ = 0 [static, private] |
Definition at line 138 of file Base_Thread_Adapter.h.
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.
ACE_INHERIT_LOG_MSG_HOOK ACE_Base_Thread_Adapter::inherit_log_msg_hook_ [static, private] |
Definition at line 137 of file Base_Thread_Adapter.h.
ACE_INIT_LOG_MSG_HOOK ACE_Base_Thread_Adapter::init_log_msg_hook_ [static, private] |
The hooks to inherit and cleanup the Log_Msg attributes.
Definition at line 136 of file Base_Thread_Adapter.h.
The ACE_Log_Msg attributes.
Definition at line 172 of file Base_Thread_Adapter.h.
ACE_SYNC_LOG_MSG_HOOK ACE_Base_Thread_Adapter::sync_log_msg_hook_ = 0 [static, private] |
Definition at line 139 of file Base_Thread_Adapter.h.
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.
ACE_THR_DESC_LOG_MSG_HOOK ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ = 0 [static, private] |
Definition at line 140 of file Base_Thread_Adapter.h.
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.