[omniORB] corba in COM object, how to shutdown, make thread (
again after few failed tests)
David Hyde
davidh@cavendish.co.uk
Tue, 19 Mar 2002 13:44:34 -0000
I've developed a COM object that connects to CORBA services.
First of all you shouldn't have to do orb->run at all. It is multithreaded
and runs fine off the Windows event loop.
Second, I hold only one instance of the orb at application scope.
Therefore all instances of the COM control within a single dll use the same
pointer. My init() function protects against multiple initialisation simply
by checking to see if the orb pointer is valid before calling orb_init().
I then call CORBA::release() on my POA and ORB objects during the dll's
ExitInstance. I've found that calling orb->destroy() at this point causes
problems, but everything seems ok if I just leave this out.
Hope this helps
David
This is a PERSONAL email. Although it is generated from a computer system
belonging to The Cavendish Organisation Ltd it is not a communication from
that company. The responsibility for this email rests solely with the
individual sending it and in no way commits Cavendish to any undertaking
whatsoever. If you feel that this email is in any way inappropriate or
offensive please forward the email and your complaint to
webmaster@cavendish.co.uk.
-----Original Message-----
From: Andrey Koubychev [mailto:email@vtc.ru]
Sent: 19 March 2002 13:35
To: omniorb-list@uk.research.att.com
Subject: [omniORB] corba in COM object, how to shutdown, make thread
(again after few failed tests)
Hello Developers,
I have some questions about "how to shutdown all corba activity
and free all resources". As I see, there are few programmers in
maillist who use corba from COM objects.
I'm familiar with COM and CORBA , but have problems with putting
all togather.
My COM object has Init() function with does ORB_init
and spawn a thread and pass orb as param like:
// for simplicity , I dont create any POAs and other stuff
ListeningThread = new omni_thread(startlisten_proc,&orb);
// Is it correct way ?
ListeningThread->start();
In thread :
CORBA::ORB_ptr orb = pOrb ;
orb->run();
Shutdown() method of COM object has the following :
orb->shutdown(0);
void * result;
ListeningThread->join (&result);
The problem starts when I try to do: Init(), Shutdown(),
Init(),Shutdown()
the second Shutdown() throws an exception on orb->shutdown(0);
So if someone created and destroyed my obj twice, I would get
some problems.
One of the possible solution at my side is to use ClassFactory for COM
objects. But this adds more complexity :) If it possible to
avoid, I will be very happy :)
--
Best regards,
Andrey mailto:email@vtc.ru