NAME

ACE_Thread_Adapter - Converts a C++ function into a function 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.

SYNOPSIS

#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; };

DESCRIPTION

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.

PUBLIC MEMBERS

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 MEMBERS

~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;

AUTHOR

Doug Schmidt schmidt@cs.wustl.edu, Jesper S. M|ller stophph@diku.dk, and a cast of thousands...

The ACE_Sched_Priority type should be used for platform-

independent thread and process priorities, by convention. int should be used for OS-specific priorities.

LIBRARY

ace