Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / apps / JAWS3 / jaws3 / Protocol_Handler.cpp
blob004f52488a2ea7c2b72a165eb4d54ec71c09d1a5
1 #ifndef JAWS_BUILD_DLL
2 #define JAWS_BUILD_DLL
3 #endif
5 #include "jaws3/Protocol_Handler.h"
6 #include "jaws3/Concurrency.h"
8 JAWS_Protocol_State::~JAWS_Protocol_State ()
13 JAWS_Protocol_Handler::JAWS_Protocol_Handler ( JAWS_Protocol_State *state
14 , void *data
16 : state_ (state)
17 , data_ (data)
18 , mb_ (& this->db_)
20 this->db_.base ((char *) this, 0 /* an infinite queue */);
24 JAWS_Protocol_Handler::~JAWS_Protocol_Handler ()
26 this->mb_.replace_data_block (0);
30 int
31 JAWS_Protocol_Handler::service ()
33 if (this->state_ == 0)
34 return -1;
36 return this->state_->service (this, this->data_);
40 void
41 JAWS_Protocol_Handler::event_complete ( const JAWS_Event_Result &result
42 , void *act
45 // This call is done in the context of the dispatching
46 // thread (e.g., by the Reactor thread, or by one of the
47 // threads in the Proactor, or by the invoker of the IO
48 // if the IO is synchronous).
50 this->state_ = this->state_->transition (result, this->data_, act);
52 // At this point, we need to cue this Handler back into
53 // the concurrency mechanism. This probably means the
54 // Message Queue of some Concurrency Task.
56 JAWS_Concurrency::instance ()->putq (this);
58 // Doing it this way is less efficient than calling into
59 // the service() method of the next state directly from
60 // here, but it gains the flexibility of a more modular
61 // concurrency mechanism.