about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorAleksey Kladov <aleksey.kladov@gmail.com>2020-01-02 04:02:48 +0100
committerAleksey Kladov <aleksey.kladov@gmail.com>2020-01-02 04:02:48 +0100
commit4d04b0b0fe16dbf2227b308907bc2652be4c7c95 (patch)
tree7b4e47929627906cce3cb20ae863c692f56c740e /src/rustllvm/RustWrapper.cpp
parent0ec370670220b712b042ee09aab067ec7e5878d5 (diff)
downloadrust-4d04b0b0fe16dbf2227b308907bc2652be4c7c95.tar.gz
rust-4d04b0b0fe16dbf2227b308907bc2652be4c7c95.zip
Remove wrong advice about spin locks from `spin_loop_hint` docs
Using a pure spin lock for a critical section in a preemptable thread
is always wrong, however short the critical section may be. The thread
might be preempted, which will cause all other threads to hammer
busily at the core for the whole quant. Moreover, if threads have
different priorities, this might lead to a priority inversion problem
and a deadlock. More generally, a spinlock is not more efficient than
a well-written mutex, which typically does several spin iterations at
the start anyway.

The advise about UP vs SMP is also irrelevant in the context of
preemptive threads.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions