[omniORB] reusing threads
Janet Tvedt
tvedt at noao.edu
Mon Dec 15 16:12:04 GMT 2003
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. The code below summarizes what I am
doing. A client calls the corba method which starts the thread. Futures
calls to the server do not occur until the previous thread has completed
(determined by receiving an event). Everything works fine the first
time the thread is started. Subsequent calls do nothing. It is almost
like the thread has died. Any ideas?
class foo : public virtual _sk_my_corba_interface, public omni_thread
{
public:
(various corba methods)
private:
void* run_undetached(void* ptr);
};
void* foo:run_undetached(void* ptr)
{
cout << "thread running" << endl;
(do something that takes a long time)
(when finished send an event)
return (void *) rv;
}
long foo:some_corba_method()
{
(some setup)
cout << "starting thread" << endl;
start_undetached();
return OK;
}
Thanks in advance!
Janet Tvedt
National Solar Observatory
More information about the omniORB-list
mailing list