summaryrefslogtreecommitdiff
path: root/ace/Base_Thread_Adapter.h
diff options
context:
space:
mode:
Diffstat (limited to 'ace/Base_Thread_Adapter.h')
-rw-r--r--ace/Base_Thread_Adapter.h135
1 files changed, 70 insertions, 65 deletions
diff --git a/ace/Base_Thread_Adapter.h b/ace/Base_Thread_Adapter.h
index 1890f83f7c4..14dca42a50b 100644
--- a/ace/Base_Thread_Adapter.h
+++ b/ace/Base_Thread_Adapter.h
@@ -1,17 +1,14 @@
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// ace
-//
-// = FILENAME
-// Base_Thread_Adapter.h
-//
-// = AUTHOR
-// Carlos O'Ryan <coryan@uci.edu>
-//
-// ============================================================================
+
+//=============================================================================
+/**
+ * @file Base_Thread_Adapter.h
+ *
+ * $Id$
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ */
+//=============================================================================
+
#ifndef ACE_BASE_THREAD_ADAPTER_H
#define ACE_BASE_THREAD_ADAPTER_H
@@ -33,45 +30,51 @@ extern "C" void ace_thread_adapter (unsigned long args);
extern "C" ACE_Export void *ace_thread_adapter (void *args);
#endif /* ACE_PSOS */
+/**
+ * @class ACE_OS_Thread_Descriptor
+ *
+ * @brief Parent class of all ACE_Thread_Descriptor classes.
+ * =
+ * Container for ACE_Thread_Descriptor members that are
+ * used in ACE_OS.
+ */
class ACE_OS_Export ACE_OS_Thread_Descriptor
{
- // = TITLE
- // Parent class of all ACE_Thread_Descriptor classes.
- //
- // =
- // Container for ACE_Thread_Descriptor members that are
- // used in ACE_OS.
public:
+ /// Get the thread creation flags.
long flags (void) const;
- // Get the thread creation flags.
protected:
+ /// For use by ACE_Thread_Descriptor.
ACE_OS_Thread_Descriptor (long flags = 0);
- // For use by ACE_Thread_Descriptor.
+ /**
+ * Keeps track of whether this thread was created "detached" or not.
+ * If a thread is *not* created detached then if someone calls
+ * <ACE_Thread_Manager::wait>, we need to join with that thread (and
+ * close down the handle).
+ */
long flags_;
- // Keeps track of whether this thread was created "detached" or not.
- // If a thread is *not* created detached then if someone calls
- // <ACE_Thread_Manager::wait>, we need to join with that thread (and
- // close down the handle).
};
+/**
+ * @class ACE_Base_Thread_Adapter
+ *
+ * @brief Base class for all the Thread_Adapters.
+ *
+ * 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>.
+ * 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.
+ */
class ACE_OS_Export ACE_Base_Thread_Adapter
{
- // = TITLE
- // Base class for all the Thread_Adapters.
- //
- // = DESCRIPTION
- // 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>.
- // 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:
ACE_Base_Thread_Adapter (ACE_THR_FUNC user_func,
void *arg,
@@ -81,75 +84,77 @@ public:
, ACE_SEH_EXCEPT_HANDLER selector = 0
, ACE_SEH_EXCEPT_HANDLER handler = 0
# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
+ /// Constructor.
);
- // Constructor.
+ /// Virtual method invoked by the thread entry point.
virtual void *invoke (void) = 0;
- // Virtual method invoked by the thread entry point.
+ /// Accessor for the C entry point function to the OS thread creation
+ /// routine.
ACE_THR_C_FUNC entry_point (void);
- // Accessor for the C entry point function to the OS thread creation
- // routine.
+ /// Invoke the close_log_msg_hook, if it is present
static void close_log_msg (void);
- // Invoke the close_log_msg_hook, if it is present
+ /// Invoke the sync_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
+ /// Invoke the thr_desc_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:
+ /// Destructor, making it private ensures that objects of this class
+ /// are allocated on the heap.
virtual ~ACE_Base_Thread_Adapter (void);
- // Destructor, making it private ensures that objects of this class
- // are allocated on the heap.
+ /// Inherit the logging features if the parent thread has an
+ /// <ACE_Log_Msg>.
void inherit_log_msg (void);
- // Inherit the logging features if the parent thread has an
- // <ACE_Log_Msg>.
private:
+ /// The hooks to inherit and cleanup the Log_Msg attributes
static ACE_INIT_LOG_MSG_HOOK init_log_msg_hook_;
static ACE_INHERIT_LOG_MSG_HOOK inherit_log_msg_hook_;
static ACE_CLOSE_LOG_MSG_HOOK close_log_msg_hook_;
static ACE_SYNC_LOG_MSG_HOOK sync_log_msg_hook_;
static ACE_THR_DESC_LOG_MSG_HOOK thr_desc_log_msg_hook_;
- // The hooks to inherit and cleanup the Log_Msg attributes
+ /// Set the Log_Msg hooks
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
+ /// Allow the ACE_Log_Msg class to set its hooks.
friend class ACE_Log_Msg;
- // Allow the ACE_Log_Msg class to set its hooks.
protected:
+ /// Thread startup function passed in by the user (C++ linkage).
ACE_THR_FUNC user_func_;
- // Thread startup function passed in by the user (C++ linkage).
+ /// Argument to thread startup function.
void *arg_;
- // Argument to thread startup function.
+ /// Entry point to the underlying OS thread creation call (C
+ /// linkage).
ACE_THR_C_FUNC entry_point_;
- // Entry point to the underlying OS thread creation call (C
- // linkage).
+ /**
+ * 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.
+ */
ACE_OS_Thread_Descriptor *thr_desc_;
- // 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.
+ /// The ACE_Log_Msg attributes.
ACE_OS_Log_Msg_Attributes log_msg_attributes_;
- // The ACE_Log_Msg attributes.
+ /// Friend declaration to avoid compiler warning: only defines a private
+ /// destructor and has no friends.
friend class ACE_Thread_Adapter_Has_Private_Destructor;
- // Friend declaration to avoid compiler warning: only defines a private
- // destructor and has no friends.
};
# if defined (ACE_HAS_INLINED_OSCALLS)