summaryrefslogtreecommitdiff
path: root/trunk/TAO/tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.cpp
blob: 35b6b316012850e45a282605052e5f7ea8d967df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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