From 29b5ae0c049074269fc472ea5635a9c969dc8bdf Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Wed, 16 Feb 2011 15:07:01 -0800 Subject: [PATCH] simplemessenger: Fix num_threads bug printout. Also add documentation to get_num_threads since its contract changed significantly. Signed-off-by: Greg Farnum --- src/common/Thread.cc | 7 +++++++ src/msg/SimpleMessenger.cc | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/common/Thread.cc b/src/common/Thread.cc index 148a6caa51ae..5acf1d09d85d 100644 --- a/src/common/Thread.cc +++ b/src/common/Thread.cc @@ -22,6 +22,13 @@ #include "common/debug.h" #include "common/Thread.h" +/** + * Return the number of threads in this process. The data is + * retrieved from /proc and includes all threads, not just + * "child" threads. + * Behavior changed in 6fb416b083d518e5f524359cc3cacb66ccc63dca + * to support eventual elimination of global variables. + */ int Thread::get_num_threads(void) { std::ostringstream oss; diff --git a/src/msg/SimpleMessenger.cc b/src/msg/SimpleMessenger.cc index 6c9e0b333db4..fd44face98d4 100644 --- a/src/msg/SimpleMessenger.cc +++ b/src/msg/SimpleMessenger.cc @@ -2429,8 +2429,8 @@ int SimpleMessenger::start(bool nodaemon) if (g_conf.daemonize && !nodaemon) { int num_threads = Thread::get_num_threads(); if (num_threads > 1) { - derr << "messenger.start BUG: there are " << num_threads << " threads" - << " already started that will now die! call messenger.start() sooner." + derr << "messenger.start BUG: there are " << num_threads - 1 + << " child threads already started that will now die! call messenger.start() sooner." << dendl; } -- 2.47.3