Task_T.cpp

Go to the documentation of this file.
00001 // Task_T.cpp,v 4.36 2005/10/28 23:55:10 ossama Exp
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 /* ACE_LACKS_PRAGMA_ONCE */
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 /* __ACE_INLINE__ */
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_LIB_TEXT ("\nthr_mgr_ = %x"), this->thr_mgr_));
00028   this->msg_queue_->dump ();
00029   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("delete_msg_queue_ = %d\n"), this->delete_msg_queue_));
00030   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("\nflags = %x"), this->flags_));
00031   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("\nmod_ = %x"), this->mod_));
00032   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("\nnext_ = %x"), this->next_));
00033   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("\ngrp_id_ = %d"), this->grp_id_));
00034   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("\nthr_count_ = %d"), this->thr_count_));
00035 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
00036   this->lock_.dump ();
00037 #endif /* ACE_MT_SAFE */
00038 
00039   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00040 #endif /* ACE_HAS_DUMP */
00041 }
00042 
00043 // If the user doesn't supply a ACE_Message_Queue pointer then we'll
00044 // allocate one dynamically.  Otherwise, we'll use the one they give.
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   // These assignments aren't strickly necessary but they help guard
00075   // against odd race conditions...
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 /* ACE_TASK_T_CPP */

Generated on Thu Nov 9 09:42:06 2006 for ACE by doxygen 1.3.6