summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Traut <manut@mecka.net>2012-12-04 23:26:00 +0100
committerManuel Traut <manut@mecka.net>2012-12-04 23:26:00 +0100
commitf9eaee58fbc23e0f6db03e7d039a30170fabc697 (patch)
tree69d4d0441908a4d4417c79c1d53815c94fca62a1
parent2a81bd3d5cc7f6653adef9f6653ff4a20709b0d7 (diff)
add destroy orb function
to enable shutdown of orb thread Signed-off-by: Manuel Traut <manut@mecka.net>
-rw-r--r--common/distrio_helper.cpp19
-rw-r--r--common/distrio_helper.h2
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);