Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tao / CSD_ThreadPool / CSD_TP_Collocated_Synch_Request.h
blobd43751740c37ae9fb998ca27aad27bac3b1d57e6
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file CSD_TP_Collocated_Synch_Request.h
7 * @author Tim Bradley <bradley_t@ociweb.com>
8 */
9 //=============================================================================
11 #ifndef TAO_CSD_TP_COLLOCATED_SYNCH_REQUEST_H
12 #define TAO_CSD_TP_COLLOCATED_SYNCH_REQUEST_H
14 #include /**/ "ace/pre.h"
16 #include "tao/CSD_ThreadPool/CSD_TP_Export.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "tao/CSD_ThreadPool/CSD_TP_Corba_Request.h"
23 #include "tao/CSD_ThreadPool/CSD_TP_Synch_Helper.h"
24 #include "tao/Exception.h"
26 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
28 namespace TAO
30 namespace CSD
32 class TP_Collocated_Synch_Request;
33 typedef TAO_Intrusive_Ref_Count_Handle<TP_Collocated_Synch_Request>
34 TP_Collocated_Synch_Request_Handle;
36 /**
37 * @class TP_Collocated_Synch_Request
39 * @brief Represents a "queue-able", synchronous, collocated,
40 * CORBA request.
42 * This kind request is the two-way or oneway(with SYNC_WITH_TARGET
43 * policy applied) collocated request. It is NOT cloned before
44 * enqueuing and the "enqueuing" thread will block until the request
45 * is dispatched/handled or cancelled.
47 class TAO_CSD_TP_Export TP_Collocated_Synch_Request
48 : public TP_Corba_Request
50 public:
51 /// Constructor.
52 TP_Collocated_Synch_Request
53 (TAO_ServerRequest& server_request,
54 const PortableServer::ObjectId& object_id,
55 PortableServer::POA_ptr poa,
56 const char* operation,
57 PortableServer::Servant servant,
58 TP_Servant_State* servant_state);
60 /// Virtual Destructor.
61 virtual ~TP_Collocated_Synch_Request();
63 /// Wait until the request has been dispatched (and completed), or
64 /// until it has been cancelled.
65 /// Returns true if the request has been dispatched, and returns
66 /// false if the request has been cancelled.
67 bool wait();
69 protected:
70 /// Note that we do not override our base class implementation of
71 /// prepare_for_queue_i() (which does nothing), because we don't
72 /// need to clone the Server Request object.
74 /// Dispatch the request to the servant.
75 virtual void dispatch_i();
77 /// Cancel the request.
78 virtual void cancel_i();
80 private:
81 /// Helper used to block and unblock the thread that invokes our
82 /// wait() method.
83 TP_Synch_Helper synch_helper_;
85 /// Set to NULL initially, and will only be set thereafter if an
86 /// exception is raised from the dispatch() call on the server_request_.
87 CORBA::Exception* exception_;
92 TAO_END_VERSIONED_NAMESPACE_DECL
94 #if defined (__ACE_INLINE__)
95 # include "tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.inl"
96 #endif /* __ACE_INLINE__ */
98 #include /**/ "ace/post.h"
100 #endif /* TAO_CSD_TP_COLLOCATED_SYNCH_REQUEST_H */