Issue #7222: Make thread "reaping" more reliable so that reference
leak-chasing test runs give sensible results. The previous method of
reaping threads could return successfully while some Thread objects were
still referenced. This also introduces a new private function:
:func:hread._count().
diff --git a/Doc/library/thread.rst b/Doc/library/thread.rst
index f8b5850..ac9d1eb 100644
--- a/Doc/library/thread.rst
+++ b/Doc/library/thread.rst
@@ -112,6 +112,20 @@
.. versionadded:: 2.5
+
+.. function:: _count()
+
+ Return the number of currently running Python threads, excluding the main
+ thread. The returned number comprises all threads created through
+ :func:`start_new_thread` as well as :class:`threading.Thread`, and not
+ yet finished.
+
+ This function is meant for internal and specialized purposes only. In
+ most applications :func:`threading.enumerate()` should be used instead.
+
+ .. versionadded:: 2.7
+
+
Lock objects have the following methods: