Class used to make copying between request scope current and thread scope current exception-safe. More...
#include <PICurrent_Guard.h>
Public Member Functions | |
PICurrent_Guard (TAO_ServerRequest &server_request, bool tsc_to_rsc) | |
Constructor. | |
~PICurrent_Guard (void) | |
Destructor. | |
Private Attributes | |
PICurrent_Impl * | src_ |
The PICurrent implementation whose slot table will be copied. | |
PICurrent_Impl * | dest_ |
Class used to make copying between request scope current and thread scope current exception-safe.
Since copies between the request scope current and thread scope current must also occur if an exception is thrown, e.g. made available to the send_exception() interception points, the "guard" idiom is used to make this action exception-safe.
Definition at line 50 of file PICurrent_Guard.h.
TAO::PICurrent_Guard::PICurrent_Guard | ( | TAO_ServerRequest & | server_request, | |
bool | tsc_to_rsc | |||
) |
Constructor.
This constructor sets up this guard to copy the data held in a given PICurrent when transitioning from that PICurrent's scope to another scope (e.g. request scope to thread scope transition immediately following receive_request_service_contexts() on server side).
tsc_to_rsc | true when copying TSC slot table to RSC slot table, i.e. after target operation completes. |
Definition at line 18 of file PICurrent_Guard.cpp.
: src_ (0), dest_ (0) { // This constructor is used on the server side. // Retrieve the thread scope current (no TSS access incurred yet). CORBA::Object_ptr pi_current_obj = server_request.orb_core ()->pi_current (); TAO::PICurrent *pi_current = dynamic_cast <TAO::PICurrent*> (pi_current_obj); // If the slot count is zero, there is nothing to copy. Prevent any // copying (and hence TSS accesses) from occurring. if (pi_current != 0 && pi_current->slot_count () != 0) { // Retrieve the request scope current. PICurrent_Impl * rsc = server_request.rs_pi_current (); // Retrieve the thread scope current. PICurrent_Impl * tsc = pi_current->tsc (); if (tsc_to_rsc) { // TSC to RSC copy. // Occurs after receive_request() interception point and // upcall. this->src_ = tsc; this->dest_ = rsc; } else { // RSC to TSC copy. // Occurs after receive_request_service_contexts() // interception point. this->src_ = rsc; this->dest_ = tsc; } } }
TAO::PICurrent_Guard::~PICurrent_Guard | ( | void | ) |
Destructor.
The destructor copies (a logical copy whenever possible) data held in a given PICurrent when transitioning from one PICurrent scope to another immediately before any ending interception points are invoked, and after the starting and intermediate (if any) interception points are invoked.
Definition at line 61 of file PICurrent_Guard.cpp.
{ if (this->src_ != 0 && this->dest_ != 0 && this->src_ != this->dest_) { this->dest_->take_lazy_copy (this->src_); } }
PICurrent_Impl* TAO::PICurrent_Guard::dest_ [private] |
The PICurrent implementation whose slot table will be filled with the contents of another PICurrent's slot table.
Definition at line 86 of file PICurrent_Guard.h.
PICurrent_Impl* TAO::PICurrent_Guard::src_ [private] |
The PICurrent implementation whose slot table will be copied.
Definition at line 82 of file PICurrent_Guard.h.