File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -134,8 +134,10 @@ use crate::hint::spin_loop;
134134/// This function is different from [`std::thread::yield_now`] which directly yields to the
135135/// system's scheduler, whereas `spin_loop_hint` does not interact with the operating system.
136136///
137- /// If actively spinning for a long time is required, e.g. because code polls a non-blocking API,
138- /// calling [`std::thread::yield_now`] or [`std::thread::sleep`] may be the best option.
137+ /// A common use case for `spin_loop_hint` is implementing bounded optimistic spinning in a CAS
138+ /// loop in synchronization primitives. To avoid problems like priority inversion, it is strongly
139+ /// recommended that the spin loop is terminated after a finite amount of iterations and an
140+ /// appropriate blocking syscall is made.
139141///
140142/// **Note**: On platforms that do not support receiving spin-loop hints this function does not
141143/// do anything at all.
You can’t perform that action at this time.
0 commit comments