Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Base_Thread_Adapter Class Reference

Base class for all the Thread_Adapters. More...

#include <Base_Thread_Adapter.h>

Inheritance diagram for ACE_Base_Thread_Adapter:

Inheritance graph
[legend]
Collaboration diagram for ACE_Base_Thread_Adapter:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_Base_Thread_Adapter (ACE_THR_FUNC user_func, void *arg, ACE_THR_C_FUNC entry_point=(ACE_THR_C_FUNC) ace_thread_adapter, ACE_OS_Thread_Descriptor *td=0)
 Constructor. More...

virtual ACE_THR_FUNC_RETURN invoke (void)=0
 Virtual method invoked by the thread entry point. More...

ACE_THR_C_FUNC entry_point (void)
 Accessor for the C entry point function to the OS thread creation routine. More...


Static Public Methods

void close_log_msg (void)
 Invoke the close_log_msg_hook, if it is present. More...

void sync_log_msg (const ACE_TCHAR *prog_name)
 Invoke the sync_log_msg_hook, if it is present. More...

ACE_OS_Thread_Descriptorthr_desc_log_msg (void)
 Invoke the thr_desc_log_msg_hook, if it is present. More...


Protected Methods

virtual ~ACE_Base_Thread_Adapter (void)
 Destructor, making it private ensures that objects of this class are allocated on the heap. More...

void inherit_log_msg (void)
 Inherit the logging features if the parent thread has an <ACE_Log_Msg>. More...


Protected Attributes

ACE_THR_FUNC user_func_
 Thread startup function passed in by the user (C++ linkage). More...

void * arg_
 Argument to thread startup function. More...

ACE_THR_C_FUNC entry_point_
 Entry point to the underlying OS thread creation call (C linkage). More...

ACE_OS_Thread_Descriptorthr_desc_
ACE_OS_Log_Msg_Attributes log_msg_attributes_
 The ACE_Log_Msg attributes. More...


Static Private Methods

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. More...


Static Private Attributes

ACE_INIT_LOG_MSG_HOOK init_log_msg_hook_ = 0
 The hooks to inherit and cleanup the Log_Msg attributes. More...

ACE_INHERIT_LOG_MSG_HOOK inherit_log_msg_hook_ = 0
ACE_CLOSE_LOG_MSG_HOOK close_log_msg_hook_ = 0
ACE_SYNC_LOG_MSG_HOOK sync_log_msg_hook_ = 0
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. More...

class ACE_Thread_Adapter_Has_Private_Destructor
 Friend declaration to avoid compiler warning: only defines a private destructor and has no friends. More...


Detailed Description

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 74 of file Base_Thread_Adapter.h.


Constructor & Destructor Documentation

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,
ACE_OS_Thread_Descriptor   td = 0
 

Constructor.

Definition at line 19 of file Base_Thread_Adapter.cpp.

References ACE_OS_TRACE, init_log_msg_hook_, and log_msg_attributes_.

00029   : user_func_ (user_func)
00030   , arg_ (arg)
00031   , entry_point_ (entry_point)
00032   , thr_desc_ (td)
00033 {
00034   ACE_OS_TRACE ("ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter");
00035 
00036   if (ACE_Base_Thread_Adapter::init_log_msg_hook_ != 0)
00037     (*ACE_Base_Thread_Adapter::init_log_msg_hook_) (
00038           this->log_msg_attributes_
00039 # if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
00040           , selector
00041           , handler
00042 # endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
00043           );
00044 }

ACE_Base_Thread_Adapter::~ACE_Base_Thread_Adapter void    [protected, virtual]
 

Destructor, making it private ensures that objects of this class are allocated on the heap.

Definition at line 46 of file Base_Thread_Adapter.cpp.

00047 {
00048 }


Member Function Documentation

void ACE_Base_Thread_Adapter::close_log_msg void    [static]
 

Invoke the close_log_msg_hook, if it is present.

Definition at line 60 of file Base_Thread_Adapter.cpp.

References close_log_msg_hook_.

Referenced by ACE_OS::cleanup_tss.

00061 {
00062   if (ACE_Base_Thread_Adapter::close_log_msg_hook_ != 0)
00063     (*ACE_Base_Thread_Adapter::close_log_msg_hook_) ();
00064 }

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 31 of file Base_Thread_Adapter.inl.

References entry_point_.

Referenced by ACE_OS::thr_create.

00032 {
00033   return this->entry_point_;
00034 }

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 51 of file Base_Thread_Adapter.cpp.

References inherit_log_msg_hook_, log_msg_attributes_, and thr_desc_.

Referenced by ACE_Thread_Adapter::invoke, and ACE_OS_Thread_Adapter::invoke.

00052 {
00053   if (ACE_Base_Thread_Adapter::inherit_log_msg_hook_ != 0)
00054     (*ACE_Base_Thread_Adapter::inherit_log_msg_hook_)(
00055            this->thr_desc_,
00056            this->log_msg_attributes_);
00057 }

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.

Referenced by 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 16 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.

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 67 of file Base_Thread_Adapter.cpp.

References ACE_TCHAR, and sync_log_msg_hook_.

Referenced by ACE_OS::fork.

00068 {
00069   if (ACE_Base_Thread_Adapter::sync_log_msg_hook_ != 0)
00070     (*ACE_Base_Thread_Adapter::sync_log_msg_hook_) (prg);
00071 }

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 74 of file Base_Thread_Adapter.cpp.

References thr_desc_log_msg_hook_.

Referenced by ACE_OS::thr_exit.

00075 {
00076   if (ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ != 0)
00077     return (*ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_) ();
00078   return 0;
00079 }


Friends And Related Function Documentation

friend class ACE_Log_Msg [friend]
 

Allow the ACE_Log_Msg class to set its hooks.

Definition at line 129 of file Base_Thread_Adapter.h.

friend class ACE_Thread_Adapter_Has_Private_Destructor [friend]
 

Friend declaration to avoid compiler warning: only defines a private destructor and has no friends.

Reimplemented in ACE_OS_Thread_Adapter.

Definition at line 155 of file Base_Thread_Adapter.h.


Member Data Documentation

void* ACE_Base_Thread_Adapter::arg_ [protected]
 

Argument to thread startup function.

Definition at line 136 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]
 

Definition at line 15 of file Base_Thread_Adapter.cpp.

Referenced by close_log_msg, and set_log_msg_hooks.

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 140 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]
 

Definition at line 14 of file Base_Thread_Adapter.cpp.

Referenced by inherit_log_msg, and set_log_msg_hooks.

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 13 of file Base_Thread_Adapter.cpp.

Referenced by ACE_Base_Thread_Adapter, and set_log_msg_hooks.

ACE_OS_Log_Msg_Attributes ACE_Base_Thread_Adapter::log_msg_attributes_ [protected]
 

The ACE_Log_Msg attributes.

Definition at line 151 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]
 

Definition at line 16 of file Base_Thread_Adapter.cpp.

Referenced by set_log_msg_hooks, and sync_log_msg.

ACE_OS_Thread_Descriptor* ACE_Base_Thread_Adapter::thr_desc_ [protected]
 

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 148 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]
 

Definition at line 17 of file Base_Thread_Adapter.cpp.

Referenced by set_log_msg_hooks, and thr_desc_log_msg.

ACE_THR_FUNC ACE_Base_Thread_Adapter::user_func_ [protected]
 

Thread startup function passed in by the user (C++ linkage).

Definition at line 133 of file Base_Thread_Adapter.h.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:46:04 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002