Re: Multi-threaded



On Wed, 2 Jun 2010, Toralf Lund wrote:

First question: Is this list actually alive???

Yes, barely.  I'm a late comer, but it looks to me like the free
software community experimented with CORBA for a few years and then
(for some good reasons) largely abandoned it in favor of other
approaches.

Second question: Can anyone explain how to set up an ORBit2 server
so that it can process several requests in parallel via
multi-threading?

The single most important thing is to request threading when you
initialize the orb:

    orb = CORBA_ORB_init(NULL, NULL, "orbit-io-thread", &ev);

I've not had any (client) threading problems since I switched from
"orbit-local-orb" to "orbit-io-thread".  This causes a new thread to
be cloned to handle of the network I/O.

But this doesn't really help me much... I mean, if I set up one
thread with a glib mainloop, what do I do in the others? Surely the
requests won't just magically end up in other threads without me
telling ORBit2 that they exits?  Should I perhaps run mainloops in
all the threads?

I don't use ORBit2 for a server, so I can't really answer that.  All I
can tell you is that requesting "orbit-io-thread" ensures that all the
networking I/O is done through a single thread, avoiding problems like
one thread receiving a reply that was intended for another thread.  Of
course, in a client environment, you can always match up replies to
the thread that requested them.

Maybe somebody else can comment on how the server code works.


					-bwb

					Brent Baccala
					cosine freesoft org


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]