GitHub Actions: Try MSVC builds with /std:c++17 and 20
[ACE_TAO.git] / ACE / ace / Task_T.cpp
blobb28dd2ccefc7de539e8386a0a09e1f557883fcfa
1 #ifndef ACE_TASK_T_CPP
2 #define ACE_TASK_T_CPP
4 #include "ace/Task_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_T.inl"
15 #endif /* __ACE_INLINE__ */
17 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
19 ACE_ALLOC_HOOK_DEFINE_Tyc(ACE_Task)
21 template <ACE_SYNCH_DECL, class TIME_POLICY> void
22 ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::dump (void) const
24 #if defined (ACE_HAS_DUMP)
25 ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::dump");
26 ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
27 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_mgr_ = %x"), this->thr_mgr_));
28 this->msg_queue_->dump ();
29 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("delete_msg_queue_ = %d\n"), this->delete_msg_queue_));
30 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nflags = %x"), this->flags_));
31 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmod_ = %x"), this->mod_));
32 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nnext_ = %x"), this->next_));
33 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\ngrp_id_ = %d"), this->grp_id_));
34 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_count_ = %d"), this->thr_count_));
35 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
36 this->lock_.dump ();
37 #endif /* ACE_MT_SAFE */
39 ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
40 #endif /* ACE_HAS_DUMP */
43 // If the user doesn't supply a ACE_Message_Queue pointer then we'll
44 // allocate one dynamically. Otherwise, we'll use the one they give.
46 template<ACE_SYNCH_DECL, class TIME_POLICY>
47 ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::ACE_Task (ACE_Thread_Manager *thr_man,
48 ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> *mq)
49 : ACE_Task_Base (thr_man),
50 msg_queue_ (0),
51 delete_msg_queue_ (false),
52 mod_ (0),
53 next_ (0)
55 ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::ACE_Task");
57 if (mq == 0)
59 typedef ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> QUEUE_TYPE;
60 ACE_NEW (mq,
61 QUEUE_TYPE);
62 this->delete_msg_queue_ = true;
65 this->msg_queue_ = mq;
68 template<ACE_SYNCH_DECL, class TIME_POLICY>
69 ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::~ACE_Task (void)
71 ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::~ACE_Task");
72 if (this->delete_msg_queue_)
73 delete this->msg_queue_;
75 // These assignments aren't strickly necessary but they help guard
76 // against odd race conditions...
77 this->delete_msg_queue_ = false;
80 template<ACE_SYNCH_DECL, class TIME_POLICY> ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *
81 ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::sibling (void)
83 ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::sibling");
84 if (this->mod_ == 0)
85 return 0;
86 else
87 return this->mod_->sibling (this);
90 template<ACE_SYNCH_DECL, class TIME_POLICY> const ACE_TCHAR *
91 ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::name (void) const
93 ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::name");
94 if (this->mod_ == 0)
95 return 0;
96 else
97 return this->mod_->name ();
100 template<ACE_SYNCH_DECL, class TIME_POLICY> ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *
101 ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::module (void) const
103 ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::module");
104 return this->mod_;
107 ACE_END_VERSIONED_NAMESPACE_DECL
109 #endif /* ACE_TASK_T_CPP */