Home Help Center

How Can I get the ThreadHook?

coloradocolorado Member colorado leeOrganization: devnetworkProject: online schedule
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

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