Cleaned up initialization of atomic fields in ProcessManager. `std::atomic<T>` has a trivial default constructor, which means `std::atomic` values are left uninitialized by default. `ProcessManager` uses two atomic fields that are default-constructed; although we `store` to them before reading from them, it would be cleaner and safer to initialize them to a well-defined value in the first place.
Review: https://reviews.apache.org/r/51984/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c0d93a33 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c0d93a33 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c0d93a33 Branch: refs/heads/master Commit: c0d93a334f05635cb7d0a986e060ccd4dad6e75f Parents: e3aa2e7 Author: Neil Conway <neil.con...@gmail.com> Authored: Mon Sep 19 13:55:08 2016 -0700 Committer: Joseph Wu <josep...@apache.org> Committed: Mon Sep 19 15:14:18 2016 -0700 ---------------------------------------------------------------------- 3rdparty/libprocess/src/process.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/c0d93a33/3rdparty/libprocess/src/process.cpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp index 1e48fd5..c0d9785 100644 --- a/3rdparty/libprocess/src/process.cpp +++ b/3rdparty/libprocess/src/process.cpp @@ -2293,10 +2293,9 @@ void SocketManager::swap_implementing_socket( ProcessManager::ProcessManager(const Option<string>& _delegate) - : delegate(_delegate) -{ - running.store(0); -} + : delegate(_delegate), + running(0), + joining_threads(false) {} ProcessManager::~ProcessManager() @@ -2355,8 +2354,6 @@ ProcessManager::~ProcessManager() long ProcessManager::init_threads() { - joining_threads.store(false); - // We create no fewer than 8 threads because some tests require // more worker threads than `sysconf(_SC_NPROCESSORS_ONLN)` on // computers with fewer cores.