Skip to content

Commit 356b4c8

Browse files
author
Arno Haase
committed
documentation enhancement for 'spin loop hint': replace 'CPU' with 'CPU or core'
1 parent 61dced1 commit 356b4c8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/libcore/hint.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ pub unsafe fn unreachable_unchecked() -> ! {
5959
/// busy-wait spin-loop without yielding control to the system's scheduler.
6060
///
6161
/// Using a busy-wait spin-loop with `spin_loop` is ideally used in situations where a
62-
/// contended lock is held by another thread executed on a different CPU and where the waiting
62+
/// contended lock is held by another thread executed on a different CPU or core and where the waiting
6363
/// times are relatively small. Because entering busy-wait spin-loop does not trigger the system's
6464
/// scheduler, no overhead for switching threads occurs. However, if the thread holding the
65-
/// contended lock is running on the same CPU, the spin-loop is likely to occupy an entire CPU slice
65+
/// contended lock is running on the same CPU or core, the spin-loop is likely to occupy an entire CPU slice
6666
/// before switching to the thread that holds the lock. If the contending lock is held by a thread
67-
/// on the same CPU or if the waiting times for acquiring the lock are longer, it is often better to
67+
/// on the same CPU or thread or if the waiting times for acquiring the lock are longer, it is often better to
6868
/// use [`std::thread::yield_now`].
6969
///
7070
/// **Note**: On platforms that do not support receiving spin-loop hints this function does not

src/libcore/sync/atomic.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,12 @@ use crate::hint::spin_loop;
134134
/// busy-wait spin-loop without yielding control to the system's scheduler.
135135
///
136136
/// Using a busy-wait spin-loop with `spin_loop_hint` is ideally used in situations where a
137-
/// contended lock is held by another thread executed on a different CPU and where the waiting
137+
/// contended lock is held by another thread executed on a different CPU or core and where the waiting
138138
/// times are relatively small. Because entering busy-wait spin-loop does not trigger the system's
139139
/// scheduler, no overhead for switching threads occurs. However, if the thread holding the
140-
/// contended lock is running on the same CPU, the spin-loop is likely to occupy an entire CPU slice
140+
/// contended lock is running on the same CPU or core, the spin-loop is likely to occupy an entire CPU slice
141141
/// before switching to the thread that holds the lock. If the contending lock is held by a thread
142-
/// on the same CPU or if the waiting times for acquiring the lock are longer, it is often better to
142+
/// on the same CPU or core or if the waiting times for acquiring the lock are longer, it is often better to
143143
/// use [`std::thread::yield_now`].
144144
///
145145
/// **Note**: On platforms that do not support receiving spin-loop hints this function does not

0 commit comments

Comments
 (0)