diff options
Diffstat (limited to 'TAO/tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.cpp')
-rw-r--r-- | TAO/tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.cpp new file mode 100644 index 00000000000..c10b11aa53b --- /dev/null +++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.cpp @@ -0,0 +1,50 @@ +// $Id$ + +#include "CSD_TP_Dispatchable_Visitor.h" + +ACE_RCSID (CSD_TP, + Dispatchable_Visitor, + "$Id$") + +#if !defined (__ACE_INLINE__) +# include "CSD_TP_Dispatchable_Visitor.inl" +#endif /* ! __ACE_INLINE__ */ + + +TAO::CSD::TP_Dispatchable_Visitor::~TP_Dispatchable_Visitor() +{ +} + + +bool +TAO::CSD::TP_Dispatchable_Visitor::visit_request(TP_Request* request, + bool& remove_flag) +{ + // Ask the request object if the target servant is "ready" to accept + // a request being dispatched to it. + if (request->is_ready()) + { + // Ok. This request is a "dispatchable" request. It is what we were + // hoping to find. + + // Save a copy of the request in our handle data member. + request->_add_ref(); + this->request_ = request; + + // Make sure that the queue will extract the request from the queue + // upon our return. + remove_flag = true; + + // Mark the target servant as being "busy". + request->mark_as_busy(); + + // Stop the visitation by returning false. + return false; + } + + // The target servant object of the request isn't ready, so the request + // is not considered to be a "dispatchable" request. + + // Return true to visit the next request in the queue (if there is one). + return true; +} |