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

Bruce Visscher visschb@rjrt.com
Wed, 01 Aug 2001 20:24:36 -0400


This is a multi-part message in MIME format.

--------------InterScan_NT_MIME_Boundary
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit



zhangzq71 wrote:
> 
> 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();

The solution is to omit this call.  You would only need to do this if you
actually want the ORB to block the current thread.

> 
>     char c;
>     getc(c);

Of course, in a more realistic example, this would be in a loop.  In order to be
portable to other ORBs, you would need:

      if (orb->work_pending())
	orb->perform_work();

inside the loop.

Note, however, that the omniORB implementation of these (work_pending() and
perform_work()) were trivial last time I checked.

HTH,

Bruce
-- 

Bruce Visscher                                        visschb@rjrt.com

--------------InterScan_NT_MIME_Boundary
Content-Type: text/plain;
	name="InterScan_Disclaimer.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="InterScan_Disclaimer.txt"

CONFIDENTIALITY NOTE:  This e-mail message, including any attachment(s), contains information that may be confidential, protected by the attorney-client or other legal privileges, and/or proprietary non-public information.  If you are not an intended recipient of this message or an authorized assistant to an intended recipient, please notify the sender by replying to this message and then delete it from your system.  Use, dissemination, distribution, or reproduction of this message and/or any of its attachments (if any) by unintended recipients is not authorized and may be unlawful.


--------------InterScan_NT_MIME_Boundary--