From f9eaee58fbc23e0f6db03e7d039a30170fabc697 Mon Sep 17 00:00:00 2001 From: Manuel Traut Date: Tue, 4 Dec 2012 23:26:00 +0100 Subject: add destroy orb function to enable shutdown of orb thread Signed-off-by: Manuel Traut --- common/distrio_helper.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'common/distrio_helper.cpp') diff --git a/common/distrio_helper.cpp b/common/distrio_helper.cpp index 451af40..7bf7f7b 100644 --- a/common/distrio_helper.cpp +++ b/common/distrio_helper.cpp @@ -64,7 +64,6 @@ void *orb_runner (void *args) ref.poa_mgr = ref.poa->the_POAManager (); ref.poa_mgr->activate (); ref.orb->run (); - ref.orb->destroy (); } catch (CORBA::Exception &e) { std::cerr << "run CORBA orb failed: " << e << std::endl; } @@ -87,13 +86,27 @@ int run_orb () return 0; } -int join_orb () +int destroy_orb () { if (ref.init != ORB_RUNNING) { - std::cerr << "corba orb not running" << std::endl; + std::cerr << "corba not initialized or orb not running" << std::endl; + return -1; + } + + try { + ref.orb->destroy (); + ref.init = ORB_INIT; + } catch (CORBA::Exception &e) { + std::cerr << "destroy CORBA orb failed: " << e << std::endl; + return -1; } + return 0; +} + +int join_orb () +{ return pthread_join (orb_thread, NULL); } -- cgit v1.2.3