|
129 | 129 | //!
|
130 | 130 | //! Note that the stack size of the main thread is *not* determined by Rust.
|
131 | 131 | //!
|
132 |
| -//! [channels]: ../../std/sync/mpsc/index.html |
133 |
| -//! [`Arc`]: ../../std/sync/struct.Arc.html |
134 |
| -//! [`spawn`]: ../../std/thread/fn.spawn.html |
135 |
| -//! [`JoinHandle`]: ../../std/thread/struct.JoinHandle.html |
136 |
| -//! [`JoinHandle::thread`]: ../../std/thread/struct.JoinHandle.html#method.thread |
137 |
| -//! [`join`]: ../../std/thread/struct.JoinHandle.html#method.join |
138 |
| -//! [`Result`]: ../../std/result/enum.Result.html |
139 |
| -//! [`Ok`]: ../../std/result/enum.Result.html#variant.Ok |
140 |
| -//! [`Err`]: ../../std/result/enum.Result.html#variant.Err |
141 |
| -//! [`panic!`]: ../../std/macro.panic.html |
142 |
| -//! [`Builder`]: ../../std/thread/struct.Builder.html |
143 |
| -//! [`Builder::stack_size`]: ../../std/thread/struct.Builder.html#method.stack_size |
144 |
| -//! [`Builder::name`]: ../../std/thread/struct.Builder.html#method.name |
145 |
| -//! [`thread::current`]: ../../std/thread/fn.current.html |
146 |
| -//! [`thread::Result`]: ../../std/thread/type.Result.html |
147 |
| -//! [`Thread`]: ../../std/thread/struct.Thread.html |
148 |
| -//! [`park`]: ../../std/thread/fn.park.html |
149 |
| -//! [`unpark`]: ../../std/thread/struct.Thread.html#method.unpark |
150 |
| -//! [`Thread::name`]: ../../std/thread/struct.Thread.html#method.name |
151 |
| -//! [`thread::park_timeout`]: ../../std/thread/fn.park_timeout.html |
152 |
| -//! [`Cell`]: ../cell/struct.Cell.html |
153 |
| -//! [`RefCell`]: ../cell/struct.RefCell.html |
154 |
| -//! [`thread_local!`]: ../macro.thread_local.html |
155 |
| -//! [`with`]: struct.LocalKey.html#method.with |
| 132 | +//! [channels]: crate::sync::mpsc |
| 133 | +//! [`join`]: JoinHandle::join |
| 134 | +//! [`Result`]: crate::result::Result |
| 135 | +//! [`Ok`]: crate::result::Result::Ok |
| 136 | +//! [`Err`]: crate::result::Result::Err |
| 137 | +//! [`thread::current`]: current |
| 138 | +//! [`thread::Result`]: Result |
| 139 | +//! [`unpark`]: Thread::unpark |
| 140 | +//! [`Thread::name`]: Thread::name |
| 141 | +//! [`thread::park_timeout`]: park_timeout |
| 142 | +//! [`Cell`]: crate::cell::Cell |
| 143 | +//! [`RefCell`]: crate::cell::RefCell |
| 144 | +//! [`with`]: LocalKey::with |
156 | 145 |
|
157 | 146 | #![stable(feature = "rust1", since = "1.0.0")]
|
158 | 147 |
|
@@ -245,12 +234,12 @@ pub use self::local::statik::Key as __StaticLocalKeyInner;
|
245 | 234 | /// handler.join().unwrap();
|
246 | 235 | /// ```
|
247 | 236 | ///
|
248 |
| -/// [`thread::spawn`]: ../../std/thread/fn.spawn.html |
249 |
| -/// [`stack_size`]: ../../std/thread/struct.Builder.html#method.stack_size |
250 |
| -/// [`name`]: ../../std/thread/struct.Builder.html#method.name |
251 |
| -/// [`spawn`]: ../../std/thread/struct.Builder.html#method.spawn |
252 |
| -/// [`io::Result`]: ../../std/io/type.Result.html |
253 |
| -/// [`unwrap`]: ../../std/result/enum.Result.html#method.unwrap |
| 237 | +/// [`stack_size`]: Builder::stack_size |
| 238 | +/// [`name`]: Builder::name |
| 239 | +/// [`spawn`]: Builder::spawn |
| 240 | +/// [`thread::spawn`]: spawn |
| 241 | +/// [`io::Result`]: crate::io::Result |
| 242 | +/// [`unwrap`]: crate::result::Result::unwrap |
254 | 243 | /// [naming-threads]: ./index.html#naming-threads
|
255 | 244 | /// [stack-size]: ./index.html#stack-size
|
256 | 245 | #[stable(feature = "rust1", since = "1.0.0")]
|
@@ -355,9 +344,7 @@ impl Builder {
|
355 | 344 | /// [`io::Result`] to capture any failure to create the thread at
|
356 | 345 | /// the OS level.
|
357 | 346 | ///
|
358 |
| - /// [`spawn`]: ../../std/thread/fn.spawn.html |
359 |
| - /// [`io::Result`]: ../../std/io/type.Result.html |
360 |
| - /// [`JoinHandle`]: ../../std/thread/struct.JoinHandle.html |
| 347 | + /// [`io::Result`]: crate::io::Result |
361 | 348 | ///
|
362 | 349 | /// # Panics
|
363 | 350 | ///
|
@@ -443,11 +430,7 @@ impl Builder {
|
443 | 430 | /// handler.join().unwrap();
|
444 | 431 | /// ```
|
445 | 432 | ///
|
446 |
| - /// [`spawn`]: ../../std/thread/fn.spawn.html |
447 |
| - /// [`Builder::spawn`]: ../../std/thread/struct.Builder.html#method.spawn |
448 |
| - /// [`io::Result`]: ../../std/io/type.Result.html |
449 |
| - /// [`JoinHandle`]: ../../std/thread/struct.JoinHandle.html |
450 |
| - /// [`JoinHandle::join`]: ../../std/thread/struct.JoinHandle.html#method.join |
| 433 | + /// [`io::Result`]: crate::io::Result |
451 | 434 | #[unstable(feature = "thread_spawn_unchecked", issue = "55132")]
|
452 | 435 | pub unsafe fn spawn_unchecked<'a, F, T>(self, f: F) -> io::Result<JoinHandle<T>>
|
453 | 436 | where
|
@@ -513,7 +496,7 @@ impl Builder {
|
513 | 496 | /// the main thread finishes). Additionally, the join handle provides a [`join`]
|
514 | 497 | /// method that can be used to join the child thread. If the child thread
|
515 | 498 | /// panics, [`join`] will return an [`Err`] containing the argument given to
|
516 |
| -/// [`panic`]. |
| 499 | +/// [`panic!`]. |
517 | 500 | ///
|
518 | 501 | /// This will create a thread using default parameters of [`Builder`], if you
|
519 | 502 | /// want to specify the stack size or the name of the thread, use this API
|
@@ -600,15 +583,9 @@ impl Builder {
|
600 | 583 | /// println!("{}", result);
|
601 | 584 | /// ```
|
602 | 585 | ///
|
603 |
| -/// [`channels`]: ../../std/sync/mpsc/index.html |
604 |
| -/// [`JoinHandle`]: ../../std/thread/struct.JoinHandle.html |
605 |
| -/// [`join`]: ../../std/thread/struct.JoinHandle.html#method.join |
606 |
| -/// [`Err`]: ../../std/result/enum.Result.html#variant.Err |
607 |
| -/// [`panic`]: ../../std/macro.panic.html |
608 |
| -/// [`Builder::spawn`]: ../../std/thread/struct.Builder.html#method.spawn |
609 |
| -/// [`Builder`]: ../../std/thread/struct.Builder.html |
610 |
| -/// [`Send`]: ../../std/marker/trait.Send.html |
611 |
| -/// [`Sync`]: ../../std/marker/trait.Sync.html |
| 586 | +/// [`channels`]: crate::sync::mpsc |
| 587 | +/// [`join`]: JoinHandle::join |
| 588 | +/// [`Err`]: crate::result::Result::Err |
612 | 589 | #[stable(feature = "rust1", since = "1.0.0")]
|
613 | 590 | pub fn spawn<F, T>(f: F) -> JoinHandle<T>
|
614 | 591 | where
|
@@ -673,11 +650,8 @@ pub fn current() -> Thread {
|
673 | 650 | /// thread::yield_now();
|
674 | 651 | /// ```
|
675 | 652 | ///
|
676 |
| -/// [`channel`]: ../../std/sync/mpsc/index.html |
677 |
| -/// [`spawn`]: ../../std/thread/fn.spawn.html |
678 |
| -/// [`join`]: ../../std/thread/struct.JoinHandle.html#method.join |
679 |
| -/// [`Mutex`]: ../../std/sync/struct.Mutex.html |
680 |
| -/// [`Condvar`]: ../../std/sync/struct.Condvar.html |
| 653 | +/// [`channel`]: crate::sync::mpsc |
| 654 | +/// [`join`]: JoinHandle::join |
681 | 655 | #[stable(feature = "rust1", since = "1.0.0")]
|
682 | 656 | pub fn yield_now() {
|
683 | 657 | imp::Thread::yield_now()
|
@@ -723,8 +697,6 @@ pub fn yield_now() {
|
723 | 697 | /// panic!()
|
724 | 698 | /// }
|
725 | 699 | /// ```
|
726 |
| -/// |
727 |
| -/// [Mutex]: ../../std/sync/struct.Mutex.html |
728 | 700 | #[inline]
|
729 | 701 | #[stable(feature = "rust1", since = "1.0.0")]
|
730 | 702 | pub fn panicking() -> bool {
|
@@ -881,10 +853,8 @@ const NOTIFIED: usize = 2;
|
881 | 853 | /// parked_thread.join().unwrap();
|
882 | 854 | /// ```
|
883 | 855 | ///
|
884 |
| -/// [`Thread`]: ../../std/thread/struct.Thread.html |
885 |
| -/// [`park`]: ../../std/thread/fn.park.html |
886 |
| -/// [`unpark`]: ../../std/thread/struct.Thread.html#method.unpark |
887 |
| -/// [`thread::park_timeout`]: ../../std/thread/fn.park_timeout.html |
| 856 | +/// [`unpark`]: Thread::unpark |
| 857 | +/// [`thread::park_timeout`]: park_timeout |
888 | 858 | //
|
889 | 859 | // The implementation currently uses the trivial strategy of a Mutex+Condvar
|
890 | 860 | // with wakeup flag, which does not actually allow spurious wakeups. In the
|
@@ -939,9 +909,6 @@ pub fn park() {
|
939 | 909 | /// amount of time waited to be precisely `ms` long.
|
940 | 910 | ///
|
941 | 911 | /// See the [park documentation][`park`] for more detail.
|
942 |
| -/// |
943 |
| -/// [`park_timeout`]: fn.park_timeout.html |
944 |
| -/// [`park`]: ../../std/thread/fn.park.html |
945 | 912 | #[stable(feature = "rust1", since = "1.0.0")]
|
946 | 913 | #[rustc_deprecated(since = "1.6.0", reason = "replaced by `std::thread::park_timeout`")]
|
947 | 914 | pub fn park_timeout_ms(ms: u32) {
|
@@ -986,8 +953,6 @@ pub fn park_timeout_ms(ms: u32) {
|
986 | 953 | /// timeout_remaining = timeout - elapsed;
|
987 | 954 | /// }
|
988 | 955 | /// ```
|
989 |
| -/// |
990 |
| -/// [park]: fn.park.html |
991 | 956 | #[stable(feature = "park_timeout", since = "1.4.0")]
|
992 | 957 | pub fn park_timeout(dur: Duration) {
|
993 | 958 | let thread = current();
|
@@ -1046,8 +1011,7 @@ pub fn park_timeout(dur: Duration) {
|
1046 | 1011 | /// assert!(thread::current().id() != other_thread_id);
|
1047 | 1012 | /// ```
|
1048 | 1013 | ///
|
1049 |
| -/// [`id`]: ../../std/thread/struct.Thread.html#method.id |
1050 |
| -/// [`Thread`]: ../../std/thread/struct.Thread.html |
| 1014 | +/// [`id`]: Thread::id |
1051 | 1015 | #[stable(feature = "thread_id", since = "1.19.0")]
|
1052 | 1016 | #[derive(Eq, PartialEq, Clone, Copy, Hash, Debug)]
|
1053 | 1017 | pub struct ThreadId(NonZeroU64);
|
@@ -1124,12 +1088,7 @@ struct Inner {
|
1124 | 1088 | /// should instead use a function like `spawn` to create new threads, see the
|
1125 | 1089 | /// docs of [`Builder`] and [`spawn`] for more details.
|
1126 | 1090 | ///
|
1127 |
| -/// [`Builder`]: ../../std/thread/struct.Builder.html |
1128 |
| -/// [`JoinHandle::thread`]: ../../std/thread/struct.JoinHandle.html#method.thread |
1129 |
| -/// [`JoinHandle`]: ../../std/thread/struct.JoinHandle.html |
1130 |
| -/// [`thread::current`]: ../../std/thread/fn.current.html |
1131 |
| -/// [`spawn`]: ../../std/thread/fn.spawn.html |
1132 |
| -
|
| 1091 | +/// [`thread::current`]: current |
1133 | 1092 | pub struct Thread {
|
1134 | 1093 | inner: Arc<Inner>,
|
1135 | 1094 | }
|
@@ -1181,8 +1140,6 @@ impl Thread {
|
1181 | 1140 | ///
|
1182 | 1141 | /// parked_thread.join().unwrap();
|
1183 | 1142 | /// ```
|
1184 |
| - /// |
1185 |
| - /// [park]: fn.park.html |
1186 | 1143 | #[stable(feature = "rust1", since = "1.0.0")]
|
1187 | 1144 | pub fn unpark(&self) {
|
1188 | 1145 | // To ensure the unparked thread will observe any writes we made
|
@@ -1326,7 +1283,7 @@ impl fmt::Debug for Thread {
|
1326 | 1283 | /// }
|
1327 | 1284 | /// ```
|
1328 | 1285 | ///
|
1329 |
| -/// [`Result`]: ../../std/result/enum.Result.html |
| 1286 | +/// [`Result`]: crate::result::Result |
1330 | 1287 | #[stable(feature = "rust1", since = "1.0.0")]
|
1331 | 1288 | pub type Result<T> = crate::result::Result<T, Box<dyn Any + Send + 'static>>;
|
1332 | 1289 |
|
@@ -1421,9 +1378,8 @@ impl<T> JoinInner<T> {
|
1421 | 1378 | /// thread::sleep(Duration::from_millis(1000));
|
1422 | 1379 | /// ```
|
1423 | 1380 | ///
|
1424 |
| -/// [`Clone`]: ../../std/clone/trait.Clone.html |
1425 |
| -/// [`thread::spawn`]: fn.spawn.html |
1426 |
| -/// [`thread::Builder::spawn`]: struct.Builder.html#method.spawn |
| 1381 | +/// [`thread::Builder::spawn`]: Builder::spawn |
| 1382 | +/// [`thread::spawn`]: spawn |
1427 | 1383 | #[stable(feature = "rust1", since = "1.0.0")]
|
1428 | 1384 | pub struct JoinHandle<T>(JoinInner<T>);
|
1429 | 1385 |
|
@@ -1462,11 +1418,10 @@ impl<T> JoinHandle<T> {
|
1462 | 1418 | /// operations that happen after `join` returns.
|
1463 | 1419 | ///
|
1464 | 1420 | /// If the child thread panics, [`Err`] is returned with the parameter given
|
1465 |
| - /// to [`panic`]. |
| 1421 | + /// to [`panic!`]. |
1466 | 1422 | ///
|
1467 |
| - /// [`Err`]: ../../std/result/enum.Result.html#variant.Err |
1468 |
| - /// [`panic`]: ../../std/macro.panic.html |
1469 |
| - /// [atomic memory orderings]: ../../std/sync/atomic/index.html |
| 1423 | + /// [`Err`]: crate::result::Result::Err |
| 1424 | + /// [atomic memory orderings]: crate::sync::atomic |
1470 | 1425 | ///
|
1471 | 1426 | /// # Panics
|
1472 | 1427 | ///
|
|
0 commit comments