Home Help Center

Force the destruction of communicator even if still-running requests, in C++

jafontjafont Member Juan Angel Font BanegasOrganization: University of Castilla la ManchaProject: Practices for subject in Master in Computer Science
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

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    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.
Sign In or Register to comment.