pw_thread: add DetachedThread helper function

Adds the pw::thread::DetachedThread function as a helper to spawn
detached threads, where the user doesn't have to worry about the
thread handle and detaching it.

Change-Id: I179e342d8e0a79a08243a4438176b1249e13c660
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/42864
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Ewout van Bekkum <ewout@google.com>
diff --git a/pw_thread/docs.rst b/pw_thread/docs.rst
index 03b1a5a..c2b5ef3 100644
--- a/pw_thread/docs.rst
+++ b/pw_thread/docs.rst
@@ -112,6 +112,27 @@
   A constructed ``pw::thread::Thread`` which represents a thread of execution
   must be EITHER detached or joined, else the destructor will assert!
 
+DetachedThread
+==============
+To make it slightly easier and cleaner to spawn detached threads without having
+to worry about thread handles, a wrapper ``DetachedThread()`` function is
+provided which creates a ``Thread`` and immediately detaches it. For example
+instead of:
+
+.. code-block:: cpp
+
+  Thread(options, foo).detach();
+
+You can instead use this helper wrapper to:
+
+.. code-block:: cpp
+
+   DetachedThread(options, foo);
+
+The arguments are directly forwarded to the Thread constructor and ergo exactly
+match the Thread constuctor arguments for creating a thread of execution.
+
+
 ThreadRoutine & ThreadCore
 ==========================
 Threads must either be invoked through a