You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2013/05/26 18:57:48 UTC
[23/28] git commit: Fixed synchronization bug when waiting for a
process.
Fixed synchronization bug when waiting for a process.
Review: https://reviews.apache.org/r/11351
Project: http://git-wip-us.apache.org/repos/asf/incubator-mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mesos/commit/6958e6d2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mesos/tree/6958e6d2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mesos/diff/6958e6d2
Branch: refs/heads/master
Commit: 6958e6d298bf211fe199a0560d601a5aea6f8590
Parents: 50d93fc
Author: Benjamin Hindman <be...@twitter.com>
Authored: Tue May 21 23:34:07 2013 -0700
Committer: Benjamin Hindman <be...@twitter.com>
Committed: Sun May 26 09:28:38 2013 -0700
----------------------------------------------------------------------
third_party/libprocess/src/process.cpp | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mesos/blob/6958e6d2/third_party/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/third_party/libprocess/src/process.cpp b/third_party/libprocess/src/process.cpp
index 91b00f8..56f1ec5 100644
--- a/third_party/libprocess/src/process.cpp
+++ b/third_party/libprocess/src/process.cpp
@@ -2545,15 +2545,20 @@ void ProcessManager::cleanup(ProcessBase* process)
// process until after we have used the process in
// SocketManager::exited).
socket_manager->exited(process);
- }
- // ***************************************************************
- // At this point we can no longer dereference the process since it
- // might already be deallocated (e.g., by the garbage collector).
- // ***************************************************************
+ // ***************************************************************
+ // At this point we can no longer dereference the process since it
+ // might already be deallocated (e.g., by the garbage collector).
+ // ***************************************************************
- if (gate != NULL) {
- gate->open();
+ // Note that we need to open the gate while synchronized on
+ // processes because otherwise we might _open_ the gate before
+ // another thread _approaches_ the gate causing that thread to
+ // wait on _arrival_ to the gate forever (see
+ // ProcessManager::wait).
+ if (gate != NULL) {
+ gate->open();
+ }
}
}