Permalink
Browse files

allow ps process to exit without barrier

  • Loading branch information...
1 parent 30175aa commit f2c697b8089f93907ac22475a02bc670a828f08d @javelinjs javelinjs committed Jul 24, 2016
Showing with 9 additions and 9 deletions.
  1. +3 −3 include/ps/internal/postoffice.h
  2. +4 −4 include/ps/ps.h
  3. +2 −2 src/postoffice.cc
@@ -35,10 +35,10 @@ class Postoffice {
/**
* \brief terminate the system
*
- * All nodes should call this function before existing. It will block until
- * every node is finalized.
+ * All nodes should call this function before existing.
+ * \param do_barrier whether to do block until every node is finalized, default true.
*/
- void Finalize();
+ void Finalize(const bool do_barrier = true);
/**
* \brief add an customer to the system. threadsafe
*/
View
@@ -49,11 +49,11 @@ inline void StartAsync(const char* argv0 = nullptr) {
/**
* \brief terminate the system
*
- * All nodes should call this function before existing. It will block until
- * every node is finalized.
+ * All nodes should call this function before existing.
+ * \param do_barrier whether to block until every node is finalized, default true.
*/
-inline void Finalize() {
- Postoffice::Get()->Finalize();
+inline void Finalize(const bool do_barrier = true) {
+ Postoffice::Get()->Finalize(do_barrier);
}
/**
* \brief Register a callback to the system which is called after Finalize()
View
@@ -67,8 +67,8 @@ void Postoffice::Start(const char* argv0, const bool do_barrier) {
if (do_barrier) Barrier(kWorkerGroup + kServerGroup + kScheduler);
}
-void Postoffice::Finalize() {
- Barrier(kWorkerGroup + kServerGroup + kScheduler);
+void Postoffice::Finalize(const bool do_barrier) {
+ if (do_barrier) Barrier(kWorkerGroup + kServerGroup + kScheduler);
van_->Stop();
if (exit_callback_) exit_callback_();
}

0 comments on commit f2c697b

Please sign in to comment.