1 #include "ace/Thread_Control.h"
2 #include "ace/Thread_Manager.h"
4 #if !defined (ACE_HAS_INLINED_OSCALLS)
5 # include "ace/Thread_Control.inl"
6 #endif /* ACE_HAS_INLINED_OSCALLS */
8 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
11 ACE_Thread_Control::dump () const
13 #if defined (ACE_HAS_DUMP)
14 ACE_OS_TRACE ("ACE_Thread_Control::dump");
15 #endif /* ACE_HAS_DUMP */
19 ACE_Thread_Control::insert (ACE_Thread_Manager
*tm
, bool insert
)
21 ACE_OS_TRACE ("ACE_Thread_Control::insert");
24 ACE_OS::thr_self (t_id
);
28 return this->tm_
->insert_thr (ACE_OS::thr_self (), t_id
);
33 // Initialize the thread controller.
34 ACE_Thread_Control::ACE_Thread_Control (ACE_Thread_Manager
*t
,
39 ACE_OS_TRACE ("ACE_Thread_Control::ACE_Thread_Control");
41 if (this->tm_
!= 0 && insert
)
44 ACE_OS::thr_self (t_id
);
45 this->tm_
->insert_thr (ACE_OS::thr_self (), t_id
);
49 // Automatically kill thread on exit.
50 ACE_Thread_Control::~ACE_Thread_Control ()
52 ACE_OS_TRACE ("ACE_Thread_Control::~ACE_Thread_Control");
54 #if defined (ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS) || defined (ACE_HAS_TSS_EMULATION) || defined (ACE_WIN32)
55 this->exit (this->status_
, 0);
57 this->exit (this->status_
, 1);
58 #endif /* ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS */
61 // Exit from thread (but clean up first).
63 ACE_Thread_Control::exit (ACE_THR_FUNC_RETURN exit_status
, int do_thr_exit
)
65 ACE_OS_TRACE ("ACE_Thread_Control::exit");
68 return this->tm_
->exit (exit_status
, do_thr_exit
);
71 #if !defined (ACE_HAS_TSS_EMULATION)
72 // With ACE_HAS_TSS_EMULATION, we let ACE_Thread_Adapter::invoke ()
73 // exit the thread after cleaning up TSS.
74 ACE_OS::thr_exit (exit_status
);
75 #endif /* ! ACE_HAS_TSS_EMULATION */
80 ACE_END_VERSIONED_NAMESPACE_DECL