Skip to content

Commit

Permalink
simplemessenger: Fix num_threads bug printout.
Browse files Browse the repository at this point in the history
Also add documentation to get_num_threads since its contract
changed significantly.

Signed-off-by: Greg Farnum <[email protected]>
  • Loading branch information
gregsfortytwo committed Feb 16, 2011
1 parent 03e56b7 commit 29b5ae0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/common/Thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/msg/SimpleMessenger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 29b5ae0

Please sign in to comment.