diff options
| -rw-r--r-- | common/distrio_helper.cpp | 19 | ||||
| -rw-r--r-- | common/distrio_helper.h | 2 |
2 files changed, 18 insertions, 3 deletions
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); } diff --git a/common/distrio_helper.h b/common/distrio_helper.h index 87c38e0..e9b161f 100644 --- a/common/distrio_helper.h +++ b/common/distrio_helper.h @@ -45,6 +45,8 @@ int init_corba (int argc, char **argv); int run_orb (void); /** join the orb - function blocks until orb is shutdown */ int join_orb (void); +/** destroy the orb - behaviour of incoming calls is undefined */ +int destroy_orb (void); /** register a digital io with a common name at the naming service */ int register_digital (Distrio_Digital_i *digital); |
