ace_thread_adapter
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.
#include <ace/OS.h>
class ACE_Thread_Adapter {
public:ACE_Thread_Adapter ( ACE_THR_FUNC user_func, void *arg, ACE_THR_C_FUNC entry_point = (ACE_THR_C_FUNC) ace_thread_adapter, ACE_Thread_Manager *thr_mgr = 0, ACE_Thread_Descriptor *td = 0 );void *invoke (void);ACE_Thread_Manager *thr_mgr (void);ACE_THR_C_FUNC entry_point (void);private:~ACE_Thread_Adapter (void);void inherit_log_msg (void);int rethrow_w32_structural_exception (void);ACE_THR_FUNC user_func_;void *arg_;ACE_THR_C_FUNC entry_point_;ACE_Thread_Manager *thr_mgr_;ACE_Thread_Descriptor *thr_desc_;ostream *ostream_;u_long priority_mask_;int tracing_enabled_;int restart_;int trace_depth_;friend class ACE_Thread_Adapter_Has_Private_Destructor;};
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.
ACE_Thread_Adapter (
ACE_THR_FUNC user_func,
void *arg,
ACE_THR_C_FUNC entry_point = (ACE_THR_C_FUNC) ace_thread_adapter,
ACE_Thread_Manager *thr_mgr = 0,
ACE_Thread_Descriptor *td = 0
);
void *invoke (void);
user_func_ with the arg. This function deletes
this, thereby rendering the object useless after the call
returns.
ACE_Thread_Manager *thr_mgr (void);
Thread_Manager.
ACE_THR_C_FUNC entry_point (void);
~ACE_Thread_Adapter (void);
void inherit_log_msg (void);
ACE_Log_Msg.
int rethrow_w32_structural_exception (void);
ACE_THR_FUNC user_func_;
void *arg_;
ACE_THR_C_FUNC entry_point_;
ACE_Thread_Manager *thr_mgr_;
ACE_Thread_Descriptor *thr_desc_;
Log_Msg and wait
until Thread_Manager fills in all information in thread
descriptor.
ostream *ostream_;
u_long priority_mask_;
int tracing_enabled_;
int restart_;
int trace_depth_;
friend class ACE_Thread_Adapter_Has_Private_Destructor;
schmidt@cs.wustl.edu, Jesper S. M|ller
stophph@diku.dk, and a cast of thousands...