You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2016/04/19 16:24:43 UTC

[7/7] mesos git commit: Windows: Libprocess: [2/2] Implemented assorted `os::` functions.

Windows: Libprocess: [2/2] Implemented assorted `os::` functions.

Review: https://reviews.apache.org/r/44131/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c19df0d8
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c19df0d8
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c19df0d8

Branch: refs/heads/master
Commit: c19df0d8196677758c4b1354f2ed052620e87a41
Parents: 30050f3
Author: Daniel Pravat <dp...@outlook.com>
Authored: Mon Apr 18 14:33:00 2016 -0400
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Tue Apr 19 10:24:14 2016 -0400

----------------------------------------------------------------------
 3rdparty/libprocess/src/process.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c19df0d8/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index afeddec..8727eb2 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -927,7 +927,7 @@ void initialize(const Option<string>& delegate)
 
     if (gethostname(hostname, sizeof(hostname)) < 0) {
       LOG(FATAL) << "Failed to initialize, gethostname: "
-                 << hstrerror(h_errno);
+                 << os::hstrerror(h_errno);
     }
 
     // Lookup IP address of local hostname.
@@ -2194,8 +2194,9 @@ long ProcessManager::init_threads()
   // TODO(xujyan): Use a smarter algorithm to allocate threads.
   // Allocating a static number of threads can cause starvation if
   // there are more waiting Processes than the number of worker
-  // threads.
-  long num_worker_threads = std::max(8L, sysconf(_SC_NPROCESSORS_ONLN));
+  // threads. On error assumes one core.
+  long num_worker_threads =
+    std::max(8L, os::cpus().isSome() ? os::cpus().get() : 1);
 
   // We allow the operator to set the number of libprocess worker
   // threads, using an environment variable. The motivation is that