summaryrefslogtreecommitdiff
path: root/TAO/tao/CSD_ThreadPool/CSD_TP_Request.inl
blob: 341a449091ec93a569a014b0cf70361e90498896 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// -*- C++ -*-
//
// $Id$

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

ACE_INLINE
TAO::CSD::TP_Request::TP_Request(PortableServer::Servant servant,
                                 TP_Servant_State*       servant_state)
  : prev_(0),
    next_(0),
    servant_ (servant),
    servant_state_(servant_state, false)
{
  // This try-catch block is not really necessary for current implementation 
  // since the _add_ref does not throw exception, but we have to add it to 
  // satisfy the non-exception builds. If _add_ref really throws an exception 
  // then this constructor needs deal with the exception.
  ACE_TRY_NEW_ENV
  {
    this->servant_->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
    ACE_TRY_CHECK;
  }
  ACE_CATCHALL
  {
  }
  ACE_ENDTRY;
}


ACE_INLINE
void
TAO::CSD::TP_Request::prepare_for_queue()
{
  this->prepare_for_queue_i();
}


ACE_INLINE
PortableServer::Servant
TAO::CSD::TP_Request::servant()
{
  // Used for chaining so we do not return a new "copy".
  return this->servant_.in();
}


ACE_INLINE
bool
TAO::CSD::TP_Request::is_ready() const
{
  if (this->servant_state_.is_nil())
    {
      // This means that the serialization of servants is off.
      // We always answer true here to indicate that the servant is
      // never busy.
      return true;
    }

  return !this->servant_state_->busy_flag();
}


ACE_INLINE
void
TAO::CSD::TP_Request::mark_as_busy()
{
  if (!this->servant_state_.is_nil())
    {
      this->servant_state_->busy_flag(true);
    }
}


ACE_INLINE
void
TAO::CSD::TP_Request::mark_as_ready()
{
  if (!this->servant_state_.is_nil())
    {
      this->servant_state_->busy_flag(false);
    }
}


ACE_INLINE
bool 
TAO::CSD::TP_Request::is_target(PortableServer::Servant servant)
{
  // Compare pointers.  Return true only if these are the exact same object.
  return (servant == this->servant_.in());
}


ACE_INLINE
void
TAO::CSD::TP_Request::dispatch()
{
  this->dispatch_i();
  
}


ACE_INLINE
void
TAO::CSD::TP_Request::cancel()
{
  this->cancel_i();
}

TAO_END_VERSIONED_NAMESPACE_DECL