00001
00002
00003 #ifndef ACE_TASK_T_CPP
00004 #define ACE_TASK_T_CPP
00005
00006 #include "ace/Task_T.h"
00007
00008 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00009 # pragma once
00010 #endif
00011
00012 #include "ace/Module.h"
00013 #include "ace/Null_Condition.h"
00014
00015 #if !defined (__ACE_INLINE__)
00016 #include "ace/Task_T.inl"
00017 #endif
00018
00019 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00020
00021 template <ACE_SYNCH_DECL> void
00022 ACE_Task<ACE_SYNCH_USE>::dump (void) const
00023 {
00024 #if defined (ACE_HAS_DUMP)
00025 ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::dump");
00026 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00027 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_mgr_ = %x"), this->thr_mgr_));
00028 this->msg_queue_->dump ();
00029 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("delete_msg_queue_ = %d\n"), this->delete_msg_queue_));
00030 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nflags = %x"), this->flags_));
00031 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmod_ = %x"), this->mod_));
00032 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nnext_ = %x"), this->next_));
00033 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ngrp_id_ = %d"), this->grp_id_));
00034 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_count_ = %d"), this->thr_count_));
00035 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
00036 this->lock_.dump ();
00037 #endif
00038
00039 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00040 #endif
00041 }
00042
00043
00044
00045
00046 template<ACE_SYNCH_DECL>
00047 ACE_Task<ACE_SYNCH_USE>::ACE_Task (ACE_Thread_Manager *thr_man,
00048 ACE_Message_Queue<ACE_SYNCH_USE> *mq)
00049 : ACE_Task_Base (thr_man),
00050 msg_queue_ (0),
00051 delete_msg_queue_ (0),
00052 mod_ (0),
00053 next_ (0)
00054 {
00055 ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::ACE_Task");
00056
00057 if (mq == 0)
00058 {
00059 ACE_NEW (mq,
00060 ACE_Message_Queue<ACE_SYNCH_USE>);
00061 this->delete_msg_queue_ = 1;
00062 }
00063
00064 this->msg_queue_ = mq;
00065 }
00066
00067 template<ACE_SYNCH_DECL>
00068 ACE_Task<ACE_SYNCH_USE>::~ACE_Task (void)
00069 {
00070 ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::~ACE_Task");
00071 if (this->delete_msg_queue_)
00072 delete this->msg_queue_;
00073
00074
00075
00076 this->delete_msg_queue_ = 0;
00077 }
00078
00079 template<ACE_SYNCH_DECL> ACE_Task<ACE_SYNCH_USE> *
00080 ACE_Task<ACE_SYNCH_USE>::sibling (void)
00081 {
00082 ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::sibling");
00083 if (this->mod_ == 0)
00084 return 0;
00085 else
00086 return this->mod_->sibling (this);
00087 }
00088
00089 template<ACE_SYNCH_DECL> const ACE_TCHAR *
00090 ACE_Task<ACE_SYNCH_USE>::name (void) const
00091 {
00092 ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::name");
00093 if (this->mod_ == 0)
00094 return 0;
00095 else
00096 return this->mod_->name ();
00097 }
00098
00099 template<ACE_SYNCH_DECL> ACE_Module<ACE_SYNCH_USE> *
00100 ACE_Task<ACE_SYNCH_USE>::module (void) const
00101 {
00102 ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::module");
00103 return this->mod_;
00104 }
00105
00106 ACE_END_VERSIONED_NAMESPACE_DECL
00107
00108 #endif