diff options
author | poberlin <poberlin@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-03-26 00:09:04 +0000 |
---|---|---|
committer | poberlin <poberlin@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-03-26 00:09:04 +0000 |
commit | 406d2ea3f3cc6e843d16f08316161056777a8d26 (patch) | |
tree | 00472167fee60a2d84283ce2538c2ebf297a62f3 | |
parent | 5f5096be886921d0229d716ee13b17a387266d32 (diff) | |
download | ATCD-406d2ea3f3cc6e843d16f08316161056777a8d26.tar.gz |
reactor deadlock avoidance
-rw-r--r-- | ACE/ace/TP_Reactor.cpp | 25 | ||||
-rw-r--r-- | ACE/ace/TP_Reactor.h | 6 | ||||
-rw-r--r-- | ACE/ace/TP_Reactor.inl | 12 |
3 files changed, 42 insertions, 1 deletions
diff --git a/ACE/ace/TP_Reactor.cpp b/ACE/ace/TP_Reactor.cpp index 73557515dcb..1f63a823459 100644 --- a/ACE/ace/TP_Reactor.cpp +++ b/ACE/ace/TP_Reactor.cpp @@ -442,11 +442,21 @@ ACE_TP_Reactor::handle_socket_events (int &event_count, if (dispatch_info.event_handler_ != this->notify_handler_) if (this->suspend_i (dispatch_info.handle_) == -1) return 0; - + //Begin added block for reactor dispatch protocol support + int resume_flag = + dispatch_info.event_handler_->resume_handler (); + int reference_counting_required = + dispatch_info.event_handler_->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + //End added block for reactor dispatch protocol support + // Call add_reference() if needed. if (dispatch_info.reference_counting_required_) dispatch_info.event_handler_->add_reference (); + //Added for reactor dispatch protocol support + this->pre_upcall_hook (dispatch_info.handle_); + // Release the lock. Others threads can start waiting. guard.release_token (); @@ -460,6 +470,19 @@ ACE_TP_Reactor::handle_socket_events (int &event_count, if (this->dispatch_socket_event (dispatch_info) == 0) ++result; + //Begin added block for reactor dispatch protocol support + if (dispatch_info.event_handler_ != this->notify_handler_ && + resume_flag == ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER) + this->resume_handler (dispatch_info.handle_); + + // Call remove_reference() if needed. + if (reference_counting_required) + { + dispatch_info.event_handler_->remove_reference(); + } + this->post_upcall_hook (dispatch_info.handle_); + //End added block for reactor dispatch protocol support + return result; } diff --git a/ACE/ace/TP_Reactor.h b/ACE/ace/TP_Reactor.h index d90474252c5..2e722a8d5b0 100644 --- a/ACE/ace/TP_Reactor.h +++ b/ACE/ace/TP_Reactor.h @@ -238,6 +238,12 @@ public: /// Return the current owner of the thread. virtual int owner (ACE_thread_t *t_id); + ///Added for reactor dispatch protocol support + virtual void pre_upcall_hook (ACE_HANDLE handle); + + ///Added for reactor dispatch protocol support + virtual void post_upcall_hook (ACE_HANDLE handle); + /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; diff --git a/ACE/ace/TP_Reactor.inl b/ACE/ace/TP_Reactor.inl index 33f3fbe2a4c..923e5b45340 100644 --- a/ACE/ace/TP_Reactor.inl +++ b/ACE/ace/TP_Reactor.inl @@ -116,4 +116,16 @@ ACE_TP_Reactor::clear_dispatch_mask (ACE_HANDLE , this->ready_set_.ex_mask_.reset (); } +//Added for reactor dispatch protocol support +ACE_INLINE void +ACE_TP_Reactor::pre_upcall_hook (ACE_HANDLE upcall_handle) +{ +} + +//Added for reactor dispatch protocol support +ACE_INLINE void +ACE_TP_Reactor::post_upcall_hook (ACE_HANDLE upcall_handle) +{ +} + ACE_END_VERSIONED_NAMESPACE_DECL |