@@ -721,33 +721,21 @@ struct Inner {
721721
722722#[ derive( Clone ) ]
723723#[ stable( feature = "rust1" , since = "1.0.0" ) ]
724- /// A handle to a thread.
724+ /// Threads are represented via the `Thread` type, which you can get in one of
725+ /// two ways:
725726///
726- /// You can use it to identify a thread (by name, for example). Most of the
727- /// time, there is no need to directly create a `Thread` struct using the
728- /// constructor, instead you should use a function like `spawn` to create
729- /// new threads, see the docs of [`Builder`] and [`spawn `] for more .
727+ /// * By spawning a new thread, e.g. using the [`thread::spawn`][`spawn`]
728+ /// function, and calling [`thread`][`JoinHandle::thread`] on the
729+ /// [`JoinHandle`].
730+ /// * By requesting the current thread, using the [`thread::current `] function .
730731///
731- /// # Examples
732+ /// The [`thread::current`] function is available even for threads not spawned
733+ /// by the APIs of this module.
734+ ///
735+ /// There is usualy no need to create a `Thread` struct yourself, one
736+ /// should instead use a function like `spawn` to create new threads, see the
737+ /// docs of [`Builder`] and [`spawn`] for more details.
732738///
733- /// ```no_run
734- /// # // Note that this example isn't executed by default because it causes
735- /// # // deadlocks on Windows unfortunately (see #25824)
736- /// use std::thread::Builder;
737- ///
738- /// for i in 0..5 {
739- /// let thread_name = format!("thread_{}", i);
740- /// Builder::new()
741- /// .name(thread_name) // Now you can identify which thread panicked
742- /// // thanks to the handle's name
743- /// .spawn(move || {
744- /// if i == 3 {
745- /// panic!("I'm scared!!!");
746- /// }
747- /// })
748- /// .unwrap();
749- /// }
750- /// ```
751739/// [`Builder`]: ../../std/thread/struct.Builder.html
752740/// [`spawn`]: ../../std/thread/fn.spawn.html
753741
0 commit comments