[omniORB] Proper way for orderly server process shutdown?

David Riddoch djr@uk.research.att.com
Mon, 12 Jul 1999 18:39:50 +0100 (GMT)


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();
}