summaryrefslogtreecommitdiff
path: root/TAO/tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.inl
blob: c92dfe4719f367bfdef21505ca6eb158d441a2d4 (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
// -*- C++ -*-
//
// $Id$

#include "ace/Auto_Ptr.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

ACE_INLINE
TAO::CSD::TP_Collocated_Synch_Request::TP_Collocated_Synch_Request
                             (TAO_ServerRequest&              server_request,
                              const PortableServer::ObjectId& object_id,
                              PortableServer::POA_ptr         poa,
                              const char*                     operation,
                              PortableServer::Servant         servant,
                              TP_Servant_State*               servant_state)
  : TP_Corba_Request(object_id,
                     poa,
                     operation,
                     servant,
                     servant_state,
                     server_request),
    exception_(0)
{
}


ACE_INLINE
bool
TAO::CSD::TP_Collocated_Synch_Request::wait(ACE_ENV_SINGLE_ARG_DECL)
{
  bool dispatched = this->synch_helper_.wait_while_pending();

  if (dispatched)
    {
      // Check to see if the dispatching caused an exception to be raised.
      if (this->exception_ != 0)
        {
          // An exception was raised during the actual dispatching to
          // the servant.  We need to raise the exception to our caller,
          // which is the thread that made the collocated request in the
          // first place.
          CORBA::Exception* ex = this->exception_;
          this->exception_ = 0;
        
#if defined (TAO_HAS_EXCEPTIONS)
          ACE_Auto_Basic_Ptr<CORBA::Exception> ex_holder(ex);
          ex->_raise ();
#else
          ACE_TRY_ENV.exception (ex);
#endif /* ACE_HAS_EXCEPTIONS */
        }
    }
  
  return dispatched;
    
}

TAO_END_VERSIONED_NAMESPACE_DECL