Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / Task_Ex_T.cpp
blobf770aff028f58893c7efa26678f462623787194d
1 #ifndef ACE_TASK_EX_T_CPP
2 #define ACE_TASK_EX_T_CPP
4 #include "ace/Task_Ex_T.h"
6 #if !defined (ACE_LACKS_PRAGMA_ONCE)
7 # pragma once
8 #endif /* ACE_LACKS_PRAGMA_ONCE */
10 #include "ace/Module.h"
11 #include "ace/Null_Condition.h"
13 #if !defined (__ACE_INLINE__)
14 #include "ace/Task_Ex_T.inl"
15 #endif /* __ACE_INLINE__ */
17 #if defined (ACE_HAS_ALLOC_HOOKS)
18 # include "ace/Malloc_Base.h"
19 #endif /* ACE_HAS_ALLOC_HOOKS */
21 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
23 ACE_ALLOC_HOOK_DEFINE_Tycc (ACE_Task_Ex)
25 template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> void
26 ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::dump () const
28 #if defined (ACE_HAS_DUMP)
29 ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::dump");
30 ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
31 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_mgr_ = %x"), this->thr_mgr_));
32 this->msg_queue_->dump ();
33 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("delete_msg_queue_ = %d\n"), this->delete_msg_queue_));
34 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nflags = %x"), this->flags_));
35 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmod_ = %x"), this->mod_));
36 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nnext_ = %x"), this->next_));
37 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\ngrp_id_ = %d"), this->grp_id_));
38 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_count_ = %d"), this->thr_count_));
39 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
40 this->lock_.dump ();
41 #endif /* ACE_MT_SAFE */
43 ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
44 #endif /* ACE_HAS_DUMP */
47 // If the user doesn't supply a ACE_Message_Queue_Ex pointer then we'll
48 // allocate one dynamically. Otherwise, we'll use the one they give.
50 template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY>
51 ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::ACE_Task_Ex (ACE_Thread_Manager *thr_man,
52 ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY> *mq)
53 : ACE_Task_Base (thr_man),
54 msg_queue_ (0),
55 delete_msg_queue_ (false),
56 mod_ (0),
57 next_ (0)
59 ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::ACE_Task_Ex");
61 if (mq == 0)
63 ACE_NEW (mq,
64 (ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>));
65 this->delete_msg_queue_ = true;
68 this->msg_queue_ = mq;
71 template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY>
72 ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::~ACE_Task_Ex ()
74 ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::~ACE_Task_Ex");
75 if (this->delete_msg_queue_)
76 delete this->msg_queue_;
78 // These assignments aren't strickly necessary but they help guard
79 // against odd race conditions...
80 this->delete_msg_queue_ = false;
83 template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *
84 ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::sibling ()
86 ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::sibling");
87 /// @todo FIXME Need to impl ACE_Moudle to support ACE_Task as well.
88 /// Now always return 0 for sibling
89 return 0;
91 if (this->mod_ == 0)
92 return 0;
93 else
94 return this->mod_->sibling (this);
98 template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> const ACE_TCHAR *
99 ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::name () const
101 ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::name");
102 if (this->mod_ == 0)
103 return 0;
104 else
105 return this->mod_->name ();
108 template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *
109 ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::module () const
111 ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::module");
112 return this->mod_;
115 ACE_END_VERSIONED_NAMESPACE_DECL
117 #endif /* ACE_TASK_EX_T_CPP */