Restore build on FreeBSD.
[getmangos.git] / dep / ACE_wrappers / ace / Task_T.cpp
blob08b36f82f0861cfd2bb160966ed85149b02dfc3b
1 // $Id: Task_T.cpp 80826 2008-03-04 14:51:23Z wotte $
3 #ifndef ACE_TASK_T_CPP
4 #define ACE_TASK_T_CPP
6 #include "ace/Task_T.h"
8 #if !defined (ACE_LACKS_PRAGMA_ONCE)
9 # pragma once
10 #endif /* ACE_LACKS_PRAGMA_ONCE */
12 #include "ace/Module.h"
13 #include "ace/Null_Condition.h"
15 #if !defined (__ACE_INLINE__)
16 #include "ace/Task_T.inl"
17 #endif /* __ACE_INLINE__ */
19 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
21 template <ACE_SYNCH_DECL> void
22 ACE_Task<ACE_SYNCH_USE>::dump (void) const
24 #if defined (ACE_HAS_DUMP)
25 ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::dump");
26 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
27 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_mgr_ = %x"), this->thr_mgr_));
28 this->msg_queue_->dump ();
29 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("delete_msg_queue_ = %d\n"), this->delete_msg_queue_));
30 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nflags = %x"), this->flags_));
31 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmod_ = %x"), this->mod_));
32 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nnext_ = %x"), this->next_));
33 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ngrp_id_ = %d"), this->grp_id_));
34 ACE_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 ACE_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>
47 ACE_Task<ACE_SYNCH_USE>::ACE_Task (ACE_Thread_Manager *thr_man,
48 ACE_Message_Queue<ACE_SYNCH_USE> *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>::ACE_Task");
57 if (mq == 0)
59 ACE_NEW (mq,
60 ACE_Message_Queue<ACE_SYNCH_USE>);
61 this->delete_msg_queue_ = true;
64 this->msg_queue_ = mq;
67 template<ACE_SYNCH_DECL>
68 ACE_Task<ACE_SYNCH_USE>::~ACE_Task (void)
70 ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::~ACE_Task");
71 if (this->delete_msg_queue_)
72 delete this->msg_queue_;
74 // These assignments aren't strickly necessary but they help guard
75 // against odd race conditions...
76 this->delete_msg_queue_ = false;
79 template<ACE_SYNCH_DECL> ACE_Task<ACE_SYNCH_USE> *
80 ACE_Task<ACE_SYNCH_USE>::sibling (void)
82 ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::sibling");
83 if (this->mod_ == 0)
84 return 0;
85 else
86 return this->mod_->sibling (this);
89 template<ACE_SYNCH_DECL> const ACE_TCHAR *
90 ACE_Task<ACE_SYNCH_USE>::name (void) const
92 ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::name");
93 if (this->mod_ == 0)
94 return 0;
95 else
96 return this->mod_->name ();
99 template<ACE_SYNCH_DECL> ACE_Module<ACE_SYNCH_USE> *
100 ACE_Task<ACE_SYNCH_USE>::module (void) const
102 ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::module");
103 return this->mod_;
106 ACE_END_VERSIONED_NAMESPACE_DECL
108 #endif /* ACE_TASK_T_CPP */