mixed threading creates an exception
Tristan Richardson
tjr@orl.co.uk
Wed, 04 Feb 1998 10:34:08 +0000
>>>>>>>>> Daniel Popowich <popowich@sovereign-hill.com> wrote:
>
> I'm using omniORB to serve up some legacy code that uses a threading
> package from ObjectSpace. ObjectSpace's thread class os_thread, like
> omni_thread, encapsulates underlying native threading in a
> cross-platform, simple-to-use class.
>
> I have run into a problem on NT4.0 when calling impl_shutdown() on a
> CORBA::BOA_ptr when the method is called from a thread created by
> os_thread. In other words, if boa->impl_shutdown is NOT called from
> the main thread, or a thread generated by omnithread I get an
> exception thrown in omni_thread::self() (src/lib/omnithread/nt.cc).
> The trace is as follows:
>
> CORBA::BOA::impl_shutdown()
> StrandScavanger::killInScavanger()
> omni_thread::join()
> omni_thread::self()
>
> I do NOT have this problem on Solaris. Exact same code, call
> boa->impl_shutdown() from an ObjectSpace thread and I have no
> problems. This problem only exists on NT.
>
> What seems particularly frustrating is that both ObjectSpace and
> omnithread appear to be using the exact same underlying win32 native
> threading.
>
> Has anyone else seen similar behaviour? Is this a bug? Any
> suggestions (except suggesting rewriting my legacy code using
> omnithread) on how to resolve this will be appreciated.
>
The call to omni_thread::self() from inside omni_thread::join() is simply
a sanity check. If you remove it, you should find everything else
still works, so I'd give that a try and see if it solves your problem.
However, there are other parts of omnithread that require an omni_thread
object for the calling thread (e.g. condition variable waits on NT). I
couldn't guarantee that omniORB doesn't use some of these features, so you
may come across other problems in calling omniORB code from a
non-omnithread.
Tristan
+--------------------------------------------------------------------+
| Tristan Richardson Email: tjr@orl.co.uk |
| ORL Tel: +44 1223 343000 |
| 24a Trumpington Street Fax: +44 1223 313542 |
| Cambridge, CB2 1QA, UK WWW: http://www.orl.co.uk/ |
+--------------------------------------------------------------------+
| ORL - The Olivetti & Oracle Research Laboratory |
+--------------------------------------------------------------------+