[omniORB] How can I get control after all orb->run()

David Hyde davidh@cavendish.co.uk
Thu, 2 Aug 2001 11:02:25 +0100


In my Win32 program I have done the following:

	MSG msg;
	while (g_bRun && GetMessage(&msg, NULL, 0, 0))  
	{
		DispatchMessage(&msg);

		if (pORB->work_pending())
			pORB->perform_work();
	}

	pORB->shutdown(0);

	pORB->destroy();
	CORBA::release(pORB);

maybe you can do something with this.  It would probably mean that you'd
have to put the wait for input routine into a seperate thread and set the
global g_bRun flag when the relevant input has been detected.

Hope this helps

David

> -----Original Message-----
> From: zhangzq71 [mailto:zhangzq71@21cn.com]
> Sent: 02 August 2001 01:05
> To: Ivanov, Roumen
> Cc: omniorb-list@uk.research.att.com
> Subject: Re: [omniORB] How can I get control after all orb->run()
> 
> 
> I think you do not understand what I mean, let me say that a 
> prgram has two things to do, one is acted the CORBA servant, 
> another is a waitting for user input, when user hit a key, 
> the program exit, if the program just has only one main 
> thread, how this will be achieved? Because after calling orb->run().
> 
> int main(int argc, char **argv)
> {
>     CORBA::ORB_var orb;
>     .
>     .
>     .
>     doing something setup CORBA
>     orb->run();
> 
>     char c;
>     getc(c);
> 
>     return 0;
> }
> 
> I am very thank you for your patiently answering my question.
> 
> zhangzq71
> 
> 
> 
> ----- Original Message ----- 
> From: "Ivanov, Roumen" <Roumen.Ivanov@drkw.com>
> To: "'zhangzq71'" <zhangzq71@21cn.com>
> Cc: <omniorb-list@uk.research.att.com>
> Sent: Wednesday, August 01, 2001 11:44 PM
> Subject: RE: [omniORB] How can I get control after all orb->run()
> 
> 
> > You are saying "...every time the orb->run() is called, the 
> program lost its
> > control..."
> > The control simply stays somewhere in omnORB's libraries 
> waiting for the
> > orb's shutdown.
> > There is nothing wrong with this to stop the program using 
> ctrl-c or kill
> > with default signal (SIGINT). 
> > As I understand you would like to continue doing some more 
> things in this
> > thread instead waiting for orb->run().
> > If this is correct just don't call orb->run and go on.
> > 
> > In case I got you wrong please be more specific.
> > 
> > 
> > -----Original Message-----
> > From: zhangzq71 [SMTP:zhangzq71@21cn.com]
> > Sent: Wednesday, August 01, 2001 15:06
> > To: Ivanov, Roumen
> > Cc: omniorb-list@uk.research.att.com
> > Subject: Re: [omniORB] How can I get control after all orb->run()
> > 
> > sorry, I don't understand, if don't call orb->run(), what 
> should I do? can
> > you give me some samples?
> > 
> > ----- Original Message ----- 
> > From: "Ivanov, Roumen" <Roumen.Ivanov@drkw.com>
> > To: "'zhangzq71'" <zhangzq71@21cn.com>
> > Cc: <omniorb-list@uk.research.att.com>
> > Sent: Wednesday, August 01, 2001 7:28 PM
> > Subject: RE: [omniORB] How can I get control after all orb->run()
> > 
> > 
> > > You don't need to call orb->run(). It is enough to 
> activate (better
> > > explicitly) your servants. In my case, after doing this, 
> I'm waiting on a
> > > semaphore, which will be posted in case my signal handler 
> gets a signal
> > for
> > > shutting down. You could do something else. About the 
> crash, there are two
> > > things I could suggest:
> > > 1. Make sure that you are creating the orb and poa on the 
> heap in xxx_ptr
> > > wrappers.
> > > 2. You should not call the shutdown from your signal 
> handler and better
> > not
> > > from within an interface method implementation
> > > Roumen
> > > -----Original Message-----
> > > From: zhangzq71 [SMTP:zhangzq71@21cn.com]
> > > Sent: Wednesday, August 01, 2001 01:37
> > > To: Len Holgate (Mail List Account)
> > > Cc: omniorb-list@uk.research.att.com
> > > Subject: Re: [omniORB] How can I get control after all orb->run()
> > > 
> > > I have tried the orb->shutdown() before, orb->run running 
> in a thread,
> > call
> > > orb->shutdown in another, but after this called, the 
> program crash. can
> > you
> > > give me some examples? Thank you very much.
> > > 
> > > zhangzq71
> > > 
> > > 
> > > ----- Original Message ----- 
> > > From: "Len Holgate (Mail List Account)" 
> <Mail-lists@dial.pipex.com>
> > > To: "zhangzq71" <zhangzq71@21cn.com>; 
> <omniorb-list@uk.research.att.com>
> > > Sent: Wednesday, August 01, 2001 5:11 AM
> > > Subject: Re: [omniORB] How can I get control after all orb->run()
> > > 
> > > 
> > > > We have an interface that has a shutdown method. The 
> shutdown method
> > > unbinds
> > > > any names we've bound in the server, does any other 
> cleanup tasks that
> > > > require the orb to still be functional and then calls
> > > orb->shutdown(false).
> > > > Active method calls complete and the run() method 
> eventually returns in
> > > the
> > > > main thread and the server exits gracefully. Works a treat.
> > > > 
> > > > Len
> > > > http://www.jetbyte.com
> > > > 
> > > > ----- Original Message -----
> > > > From: "zhangzq71" <zhangzq71@21cn.com>
> > > > To: <omniorb-list@uk.research.att.com>
> > > > Sent: Tuesday, July 31, 2001 2:58 PM
> > > > Subject: [omniORB] How can I get control after all orb->run()
> > > > 
> > > > 
> > > > > every time the orb->run() is called, the program lost 
> its control, how
> > > can
> > > > I stop the program rather than hit Ctrl+break?
> > > > >
> > > > > zhangzq71
> > > > >
> > > > >
> > > > 
> > > > 
> > > > 
> > > 
> > 
>