diff options
Diffstat (limited to 'TAO/tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.cpp')
-rw-r--r-- | TAO/tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.cpp new file mode 100644 index 00000000000..35b6b316012 --- /dev/null +++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.cpp @@ -0,0 +1,48 @@ +// $Id$ + +#include "tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.h" +#include "tao/CSD_ThreadPool/CSD_TP_Request.h" + +ACE_RCSID (CSD_TP, + Cancel_Visitor, + "$Id$") + +#if !defined (__ACE_INLINE__) +# include "tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.inl" +#endif /* ! __ACE_INLINE__ */ + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +TAO::CSD::TP_Cancel_Visitor::~TP_Cancel_Visitor() +{ +} + + +bool +TAO::CSD::TP_Cancel_Visitor::visit_request(TP_Request* request, + bool& remove_flag) +{ + // If our servant_ data member is in the 'nil' state, then + // we are supposed to cancel *ALL* requests that we visit. + // + // Otherwise, if our servant_ data member is not in the 'nil' state, + // we are supposed to cancel only requests that target our specific + // servant_. + + if ((this->servant_.in() == 0) || (request->is_target(this->servant_.in()))) + { + // Set the remove_flag to true so that this request is removed + // (and released) from the queue when we finish our visit. + remove_flag = true; + + // Cancel the request + request->cancel(); + } + + // Since we are either cancelling requests to any servant or a + // specific servant, always continue visitation. + return true; +} + +TAO_END_VERSIONED_NAMESPACE_DECL |