diff options
| author | Manuel Traut <manut@mecka.net> | 2012-12-04 23:26:00 +0100 |
|---|---|---|
| committer | Manuel Traut <manut@mecka.net> | 2012-12-04 23:26:00 +0100 |
| commit | f9eaee58fbc23e0f6db03e7d039a30170fabc697 (patch) | |
| tree | 69d4d0441908a4d4417c79c1d53815c94fca62a1 /common/distrio_helper.cpp | |
| parent | 2a81bd3d5cc7f6653adef9f6653ff4a20709b0d7 (diff) | |
add destroy orb function
to enable shutdown of orb thread
Signed-off-by: Manuel Traut <manut@mecka.net>
Diffstat (limited to 'common/distrio_helper.cpp')
| -rw-r--r-- | common/distrio_helper.cpp | 19 |
1 files changed, 16 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); } |
