[omniORB] reusing threads
Duncan Grisby
duncan at grisby.org
Mon Dec 22 16:16:11 GMT 2003
On Monday 15 December, Janet Tvedt wrote:
> Is there an easy way to reuse a thread in a server object? I am trying
> to reuse the same thread in an application to avoid any overhead from
> thread creation/destruction.
What you are trying to do is to restart an omni_thread object after
the thread has exited. The slow thing about starting a thread is not
the allocation of the object, but the startup of the actual underlying
system thread, so even if you could start an omni_thread object once
it has stopped (which you can't), it wouldn't help you much.
What I think you need to do is to start a thread once, separately from
your servant object, and feed it work to do through a work queue. It's
not hard to implement a work queue with a mutex and a condition
variable.
Cheers,
Duncan.
--
-- Duncan Grisby --
-- duncan at grisby.org --
-- http://www.grisby.org --
More information about the omniORB-list
mailing list