Task_Ex_T.cpp

Go to the documentation of this file.
00001 // Task_Ex_T.cpp,v 1.4 2005/10/28 23:55:10 ossama Exp
00002 
00003 #ifndef ACE_TASK_EX_T_CPP
00004 #define ACE_TASK_EX_T_CPP
00005 
00006 #include "ace/Task_Ex_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_Ex_T.inl"
00017 #endif /* __ACE_INLINE__ */
00018 
00019 
00020 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00021 
00022 template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> void
00023 ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::dump (void) const
00024 {
00025 #if defined (ACE_HAS_DUMP)
00026   ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::dump");
00027   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00028   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("\nthr_mgr_ = %x"), this->thr_mgr_));
00029   this->msg_queue_->dump ();
00030   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("delete_msg_queue_ = %d\n"), this->delete_msg_queue_));
00031   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("\nflags = %x"), this->flags_));
00032   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("\nmod_ = %x"), this->mod_));
00033   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("\nnext_ = %x"), this->next_));
00034   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("\ngrp_id_ = %d"), this->grp_id_));
00035   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("\nthr_count_ = %d"), this->thr_count_));
00036 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
00037   this->lock_.dump ();
00038 #endif /* ACE_MT_SAFE */
00039 
00040   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00041 #endif /* ACE_HAS_DUMP */
00042 }
00043 
00044 // If the user doesn't supply a ACE_Message_Queue_Ex pointer then we'll
00045 // allocate one dynamically.  Otherwise, we'll use the one they give.
00046 
00047 template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE>
00048 ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::ACE_Task_Ex (ACE_Thread_Manager *thr_man,
00049                                    ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE> *mq)
00050   : ACE_Task_Base (thr_man),
00051     msg_queue_ (0),
00052     delete_msg_queue_ (0),
00053     mod_ (0),
00054     next_ (0)
00055 {
00056   ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::ACE_Task_Ex");
00057 
00058   if (mq == 0)
00059     {
00060       ACE_NEW (mq,
00061                (ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>));
00062       this->delete_msg_queue_ = 1;
00063     }
00064 
00065   this->msg_queue_ = mq;
00066 }
00067 
00068 template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE>
00069 ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::~ACE_Task_Ex (void)
00070 {
00071   ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::~ACE_Task_Ex");
00072   if (this->delete_msg_queue_)
00073     delete this->msg_queue_;
00074 
00075   // These assignments aren't strickly necessary but they help guard
00076   // against odd race conditions...
00077   this->delete_msg_queue_ = 0;
00078 }
00079 
00080 template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_Task<ACE_SYNCH_USE> *
00081 ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::sibling (void)
00082 {
00083   ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::sibling");
00084   /// @todo FIXME Need to impl ACE_Moudle to support ACE_Task as well.
00085   /// Now always return 0 for sibling
00086   return 0;
00087 /*
00088   if (this->mod_ == 0)
00089     return 0;
00090   else
00091     return this->mod_->sibling (this);
00092 */
00093 }
00094 
00095 template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> const ACE_TCHAR *
00096 ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::name (void) const
00097 {
00098   ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::name");
00099   if (this->mod_ == 0)
00100     return 0;
00101   else
00102     return this->mod_->name ();
00103 }
00104 
00105 template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_Module<ACE_SYNCH_USE> *
00106 ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::module (void) const
00107 {
00108   ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::module");
00109   return this->mod_;
00110 }
00111 
00112 ACE_END_VERSIONED_NAMESPACE_DECL
00113 
00114 #endif /* ACE_TASK_EX_T_CPP */

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