00001 #include "ace_pch.h"
00002
00003
00004
00005 #include "ace/config-all.h"
00006 #if defined (ACE_LEGACY_MODE)
00007
00008
00009 # include "ace/Thread_Exit.h"
00010 #endif
00011
00012
00013 #include "ace/Thread_Control.h"
00014 #include "ace/Thread_Manager.h"
00015
00016 ACE_RCSID(ace, Thread_Control, "$Id: Thread_Control.cpp,v 1.1.1.2.2.1 2003/03/13 19:44:22 chad Exp $")
00017
00018 #if !defined (ACE_HAS_INLINED_OSCALLS)
00019 # include "ace/Thread_Control.inl"
00020 #endif
00021
00022 void
00023 ACE_Thread_Control::dump (void) const
00024 {
00025 ACE_OS_TRACE ("ACE_Thread_Control::dump");
00026 }
00027
00028 int
00029 ACE_Thread_Control::insert (ACE_Thread_Manager *tm, int insert)
00030 {
00031 ACE_OS_TRACE ("ACE_Thread_Control::insert");
00032
00033 ACE_hthread_t t_id;
00034 ACE_OS::thr_self (t_id);
00035 this->tm_ = tm;
00036
00037 if (insert)
00038 return this->tm_->insert_thr (ACE_OS::thr_self (), t_id);
00039 else
00040 return 0;
00041 }
00042
00043
00044
00045 ACE_Thread_Control::ACE_Thread_Control (ACE_Thread_Manager *t,
00046 int insert)
00047 : tm_ (t),
00048 status_ (0)
00049 {
00050 ACE_OS_TRACE ("ACE_Thread_Control::ACE_Thread_Control");
00051
00052 if (this->tm_ != 0 && insert)
00053 {
00054 ACE_hthread_t t_id;
00055 ACE_OS::thr_self (t_id);
00056 this->tm_->insert_thr (ACE_OS::thr_self (), t_id);
00057 }
00058 }
00059
00060
00061
00062 ACE_Thread_Control::~ACE_Thread_Control (void)
00063 {
00064 ACE_OS_TRACE ("ACE_Thread_Control::~ACE_Thread_Control");
00065
00066 #if defined (ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS) || defined (ACE_HAS_TSS_EMULATION) || defined (ACE_WIN32)
00067 this->exit (this->status_, 0);
00068 #else
00069 this->exit (this->status_, 1);
00070 #endif
00071 }
00072
00073
00074
00075 ACE_THR_FUNC_RETURN
00076 ACE_Thread_Control::exit (ACE_THR_FUNC_RETURN exit_status, int do_thr_exit)
00077 {
00078 ACE_OS_TRACE ("ACE_Thread_Control::exit");
00079
00080 if (this->tm_ != 0)
00081 return this->tm_->exit (exit_status, do_thr_exit);
00082 else
00083 {
00084 #if !defined (ACE_HAS_TSS_EMULATION)
00085
00086
00087 ACE_OS::thr_exit (exit_status);
00088 #endif
00089 return 0;
00090 }
00091 }