[omniORB] SINGLE_THREAD_MODEL and in-process calls

Alex Tingle alex.omniorb at firetree.net
Tue May 10 20:04:13 BST 2005


On Sunday 8 May, I wrote:

> > Do in-process calls violate the POA SINGLE_THREAD_MODEL?
> > 
> > As I understand it, there should only ever be one active incoming
> > method invocation in a SINGLE_THREAD_MODEL POA. However this rule
> > doesn't seem to be obeyed when the call comes from inside the same
> > process.

Duncan Grisby <duncan at grisby.org> replied:

> In process calls certainly should obey the single thread model. Look at
> the use of pd_call_lock in poa.cc. Note that recursive calls are
> permitted, though, so you can't deadlock against yourself doing purely
> local calls.

Excellent. Thank you.

> What makes you think it's not working?

I turned on thread tracing and observed my servant methods running in
different threads.

Using a lock ensures that there is no concurrency, but I can imagine
circumstances where this solution could still trap the unwary: Imagine a
servant method that locks a mutex and another that unlocks it. The naive
developer would assume that this would be safe in a SINGLE_THREAD_MODEL
POA.

I imagine that the MAIN_THREAD_MODEL works in the same way. So there is
NO WAY to guarantee that all calls are running in the same thread. I'll
have to remember that.

-Alex

-- 
:: alex tingle
:: http://www.firetree.net/consulting/
:: alex.tingle AT firetree.net  +44-7901-552763 



More information about the omniORB-list mailing list