diff options
Diffstat (limited to 'TAO/tao/Thread_Lane_Resources.cpp')
-rw-r--r-- | TAO/tao/Thread_Lane_Resources.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/TAO/tao/Thread_Lane_Resources.cpp b/TAO/tao/Thread_Lane_Resources.cpp index dadbd317a79..cf90efa4619 100644 --- a/TAO/tao/Thread_Lane_Resources.cpp +++ b/TAO/tao/Thread_Lane_Resources.cpp @@ -146,3 +146,32 @@ TAO_Thread_Lane_Resources::finalize (void) delete this->transport_cache_; delete this->leader_follower_; } + +void +TAO_Thread_Lane_Resources::shutdown_reactor (void) +{ + TAO_Leader_Follower &leader_follower = + this->leader_follower (); + + ACE_GUARD (TAO_SYNCH_MUTEX, + ace_mon, + leader_follower.lock ()); + + // Wakeup all the threads waiting blocked in the event loop, this + // does not guarantee that they will all go away, but reduces the + // load on the POA.... + ACE_Reactor *reactor = + leader_follower.reactor (); + + reactor->wakeup_all_threads (); + + // If there are some client threads running we have to wait until + // they finish, when the last one does it will shutdown the reactor + // for us. Meanwhile no new requests will be accepted because the + // POA will not process them. + if (!leader_follower.has_clients ()) + { + // Wake up all waiting threads in the reactor. + reactor->end_reactor_event_loop (); + } +} |