Also add documentation to get_num_threads since its contract
changed significantly.
Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
#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;
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;
}