[omniORB] Proper way for orderly server process shutdown?

Ken Feuerman kfeuerma@Adobe.COM
Mon, 12 Jul 1999 10:57:00 -0700


David,

Not so sure this is quite the right way to go.  I'd be concerned about a
race condition where the shutdown_thread_fn() actually executes and
completes prior to the shutdown_orb()'s call stack unwinding.  For example,
what would happen if shutdown_thread_fn() executed in its entirety while
shutdown_orb() was pre-empted right after the new omni_thread call, but
before fully leaving the function?

--Ken Feuerman.


At 06:39 PM 7/12/99 +0100, David Riddoch wrote:
>On Mon, 12 Jul 1999 Wil_Evers@doosys.com wrote:
>
>> By the way, there is a comment in CORBA.h saying one shouldn't call
>> boa->impl_shutdown() from an interface implementation.  I take it that only
>> applies to boa->destroy()?
>
>
>It applies to both impl_shutdown() and destroy().
>
>The best way to shut down the ORB in response to a method invocation is
>two spawn a new thread to do the work.  Thus the CORBA call can complete
>and allow the shutdown to proceed.
>
>
>eg.
>
>static void
>shutdown_thread_fn(void* args)
>{
>  CORBA::BOA_var boa = CORBA::BOA::getBOA();
>  boa->impl_shutdown();
>}
>
>
>void MyObj_i::shutdown_orb()
>{
>  (new omni_thread(shutdown_thread_fn, 0))->start();
>}
>
>
>
>