Archived
This forum has been archived. Please start a new discussion on GitHub.
Force the destruction of communicator even if still-running requests, in C++
Hello,
I am using Ice 3.5.1 with C++, and I have the following problem:
In the server side, when I recieve a signal, I want to destroy the communicator even if there are running threads dispatching operations. Callling Communicator::destroy() waits for all running threads to terminate before it returns. If a thread is blocked(), Communicator:destroy() never returns. So, this is my question:
Is there a way to force the destruction of a communicator even if threre are running threads dispatching operations?
Kind regards,
Juan
I am using Ice 3.5.1 with C++, and I have the following problem:
In the server side, when I recieve a signal, I want to destroy the communicator even if there are running threads dispatching operations. Callling Communicator::destroy() waits for all running threads to terminate before it returns. If a thread is blocked(), Communicator:destroy() never returns. So, this is my question:
Is there a way to force the destruction of a communicator even if threre are running threads dispatching operations?
Kind regards,
Juan
0
Comments
-
Hi,
There's no clean way to interrupt a thread in C++. So your dispatching code should instead use non-blocking operations and check the communicator status if it's supposed to return in a timely fashion when the communicator is shutdown. Your code can call Communicator::isShutdown() for this purpose. The communicator object is accessible through the Ice::Current object provided to the servant dispatch. You can call the getCommunicator() operation on the Ice::Current adapter data member.
Cheers,
Benoit.0