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 2017/07/19 20:21:24 UTC
[5/7] mesos git commit: Replaced std::map with hashmap for
ProcessManager::processes.
Replaced std::map with hashmap for ProcessManager::processes.
Review: https://reviews.apache.org/r/60829
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0d2a4940
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0d2a4940
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0d2a4940
Branch: refs/heads/master
Commit: 0d2a4940bc118c9ace7be5ca25065e42c454130c
Parents: 4936a32
Author: Benjamin Hindman <be...@gmail.com>
Authored: Thu Jun 22 23:49:00 2017 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Wed Jul 19 13:18:40 2017 -0700
----------------------------------------------------------------------
3rdparty/libprocess/src/process.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/0d2a4940/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index dff78b0..182dd91 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -566,7 +566,7 @@ private:
const Option<string> delegate;
// Map of all local spawned and running processes.
- map<string, ProcessBase*> processes;
+ hashmap<string, ProcessBase*> processes;
std::recursive_mutex processes_mutex;
// Gates for waiting threads (protected by processes_mutex).
@@ -2848,11 +2848,12 @@ ProcessReference ProcessManager::use(const UPID& pid)
{
if (pid.address == __address__) {
synchronized (processes_mutex) {
- if (processes.count(pid.id) > 0) {
+ Option<ProcessBase*> process = processes.get(pid.id);
+ if (process.isSome()) {
// Note that the ProcessReference constructor _must_ get
// called while holding the lock on processes so that waiting
// for references is atomic (i.e., race free).
- return ProcessReference(processes[pid.id]);
+ return ProcessReference(process.get());
}
}
}