[omniORB] Re: run Orb in separate thread

J-M Epitalon Jean-Marie.Epitalon at cerfacs.fr
Fri Mar 31 17:01:22 BST 2006


Hello,

I'll take pleasure at replying to my own question:
I could see two mistakes in my source code:

1) The thread object should be allocated on the heap and not on the
stack. In that particular case, I cannot see why this triggers a SEGV
since the program doesn't pop the data from the stack after creating the
thread. Instead it calls a subroutine that runs forever (not displayed
in the sample code).

2) the prototype for the virtual run method is incorrect...
It should be
     void run(void * x) {orb->run();  /* then */orb->destroy();}


On Fri, 2006-03-31 at 15:10, J-M Epitalon wrote:
> Hello,
> 
> I am new to CORBA and omniORB.
> I try to run the orb in a separate thread. That is, when it is time to
> call orb->run, I call this in a thread main function.
> This causes a SEGV.
> 
> Did I something wrong ?
> Could you help me, please ?
> 
> Below is an extract of the code:
> 
> ////////////////////////
> 
> class omniORB_thread : public omni_thread
> {
> private:
>     CORBA::ORB_var& orb;
> 
> public:
>     omniORB_thread (CORBA::ORB_var& _orb) : orb(_orb) {}
> 
>     int run(void) {orb->run();  /* then */orb->destroy();}
> };
> 
> //////////////////////////
> 
> main()
> {
>     CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
>     ...
>     omniORB_thread orb_thread(orb);
>     orb_thread.start();
>     ...
> }
-- 
Jean-Marie Epitalon
CERFACS
42, av Coriolis
31057 TOULOUSE Cedex
Tel: 05 61 19 30 72




More information about the omniORB-list mailing list