#include <Thread_Control.h>
Collaboration diagram for ACE_Thread_Control:
Public Member Functions | |
ACE_Thread_Control (ACE_Thread_Manager *tm=0, int insert=0) | |
~ACE_Thread_Control (void) | |
ACE_THR_FUNC_RETURN | exit (ACE_THR_FUNC_RETURN status, int do_thr_exit) |
int | insert (ACE_Thread_Manager *tm, int insert=0) |
ACE_Thread_Manager * | thr_mgr (void) |
Returns the current . | |
ACE_Thread_Manager * | thr_mgr (ACE_Thread_Manager *) |
ACE_THR_FUNC_RETURN | status (ACE_THR_FUNC_RETURN status) |
Set the exit status (and return existing status). | |
ACE_THR_FUNC_RETURN | status (void) |
Get the current exit status. | |
void | dump (void) const |
Dump the state of an object. | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
Private Attributes | |
ACE_Thread_Manager * | tm_ |
Pointer to the thread manager for this block of code. | |
ACE_THR_FUNC_RETURN | status_ |
Keeps track of the exit status for the thread. |
A ACE_Thread_Manager uses this class to ensure that threads it spawns automatically register and unregister themselves with it. This class can be stored in thread-specific storage using the ACE_TSS wrapper. When a thread exits the <ACE_TSS::cleanup> function deletes this object, thereby ensuring that it gets removed from its associated ACE_Thread_Manager.
Definition at line 43 of file Thread_Control.h.
|
Initialize the thread control object. If != 0, then register the thread with the Thread_Manager. Definition at line 48 of file Thread_Control.cpp. References ACE_hthread_t, ACE_OS_TRACE, ACE_Thread_Manager::insert_thr(), ACE_OS::thr_self(), and tm_.
00050 : tm_ (t), 00051 status_ (0) 00052 { 00053 ACE_OS_TRACE ("ACE_Thread_Control::ACE_Thread_Control"); 00054 00055 if (this->tm_ != 0 && insert) 00056 { 00057 ACE_hthread_t t_id; 00058 ACE_OS::thr_self (t_id); 00059 this->tm_->insert_thr (ACE_OS::thr_self (), t_id); 00060 } 00061 } |
|
Remove the thread from its associated and exit the thread if is enabled. Definition at line 65 of file Thread_Control.cpp. References ACE_OS_TRACE, and exit().
00066 { 00067 ACE_OS_TRACE ("ACE_Thread_Control::~ACE_Thread_Control"); 00068 00069 #if defined (ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS) || defined (ACE_HAS_TSS_EMULATION) || defined (ACE_WIN32) 00070 this->exit (this->status_, 0); 00071 #else 00072 this->exit (this->status_, 1); 00073 #endif /* ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS */ 00074 } |
|
Dump the state of an object.
Definition at line 24 of file Thread_Control.cpp. References ACE_OS_TRACE.
00025 { 00026 #if defined (ACE_HAS_DUMP) 00027 ACE_OS_TRACE ("ACE_Thread_Control::dump"); 00028 #endif /* ACE_HAS_DUMP */ 00029 } |
|
Remove this thread from its associated ACE_Thread_Manager and exit the thread if do_thr_exit is enabled. Definition at line 79 of file Thread_Control.cpp. References ACE_OS_TRACE, ACE_Thread_Manager::exit(), ACE_OS::thr_exit(), and tm_. Referenced by ~ACE_Thread_Control().
00080 { 00081 ACE_OS_TRACE ("ACE_Thread_Control::exit"); 00082 00083 if (this->tm_ != 0) 00084 return this->tm_->exit (exit_status, do_thr_exit); 00085 else 00086 { 00087 #if !defined (ACE_HAS_TSS_EMULATION) 00088 // With ACE_HAS_TSS_EMULATION, we let ACE_Thread_Adapter::invoke () 00089 // exit the thread after cleaning up TSS. 00090 ACE_OS::thr_exit (exit_status); 00091 #endif /* ! ACE_HAS_TSS_EMULATION */ 00092 return 0; 00093 } 00094 } |
|
Store the and use it to register ourselves for correct shutdown. Definition at line 32 of file Thread_Control.cpp. References ACE_hthread_t, ACE_OS_TRACE, ACE_Thread_Manager::insert_thr(), ACE_OS::thr_self(), and tm_. Referenced by ACE_Thread_Exit::thr_mgr().
00033 { 00034 ACE_OS_TRACE ("ACE_Thread_Control::insert"); 00035 00036 ACE_hthread_t t_id; 00037 ACE_OS::thr_self (t_id); 00038 this->tm_ = tm; 00039 00040 if (insert) 00041 return this->tm_->insert_thr (ACE_OS::thr_self (), t_id); 00042 else 00043 return 0; 00044 } |
|
Get the current exit status.
Definition at line 19 of file Thread_Control.inl. References ACE_OS_TRACE.
00020 { 00021 ACE_OS_TRACE ("ACE_Thread_Control::status"); 00022 return this->status_; 00023 } |
|
Set the exit status (and return existing status).
Definition at line 10 of file Thread_Control.inl. References ACE_OS_TRACE.
00011 { 00012 ACE_OS_TRACE ("ACE_Thread_Control::status"); 00013 return this->status_ = s; 00014 } |
|
Atomically set a new and return the old . Definition at line 38 of file Thread_Control.inl. References ACE_OS_TRACE, and tm_.
00039 { 00040 ACE_OS_TRACE ("ACE_Thread_Control::thr_mgr"); 00041 ACE_Thread_Manager *o_tm = this->tm_; 00042 this->tm_ = tm; 00043 return o_tm; 00044 } |
|
Returns the current .
Definition at line 28 of file Thread_Control.inl. References ACE_OS_TRACE, and tm_.
00029 { 00030 ACE_OS_TRACE ("ACE_Thread_Control::thr_mgr"); 00031 return this->tm_; 00032 } |
|
Declare the dynamic allocation hooks.
Definition at line 81 of file Thread_Control.h. |
|
Keeps track of the exit status for the thread.
Definition at line 88 of file Thread_Control.h. |
|
Pointer to the thread manager for this block of code.
Definition at line 85 of file Thread_Control.h. Referenced by ACE_Thread_Control(), exit(), insert(), and thr_mgr(). |