Archived

This forum has been archived. Please start a new discussion on GitHub.

How Can I get the ThreadHook?

I find in Ice internal, using follow statement can get ThreadHook:

ThreadHookPtr threadHook = ThreadHookPtr::dynamicCast(IceInternal::getInstance(_communicator)->initializationData().threadHook);

How can I get the ThreadHook in main thread? I can not use IceInternal::getInstance.
How can I get a coomunicator's initializationData?

I found in ThreadHookPlugin's constructor:
IceInternal::InstancePtr instance = IceInternal::getInstance(communicator);
instance->setThreadHook(threadHook);
}

Can I get communicator instance out of IceInternal, so I can call setThreadHook?

Comments

  • benoit
    benoit Rennes, France
    Hi,

    The user application is the one which is supposed to provide the thread hook to the Ice communicator so it shouldn't need to retrieve it from the communicator. If it needs it for other purposes, it should keep around a reference to it.

    Cheers,
    Benoit.
  • I know, and I want a elegant implementation.
    Now, I use the method as you said, but I think it is ugly.
    but I thank your reply.