Skip to content

Commit e6597e1

Browse files
committed
Mention interrupts and green threads
1 parent 8fc3ab2 commit e6597e1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/doc/unstable-book/src/compiler-barriers.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ racing *with itself*. That is, if a given thread is executing one piece
3232
of code, and is then interrupted, and starts executing code elsewhere
3333
(while still in the same thread, and conceptually still on the same
3434
core). In traditional programs, this can only occur when a signal
35-
handler is registered. Consider the following code:
35+
handler is registered. In more low-level code, such situations can also
36+
arise when handling interrupts, when implementing green threads with
37+
pre-emption, etc.
38+
39+
To give a straightforward example of when a `compiler_barrier` is
40+
necessary, consider the following example:
3641

3742
```rust
3843
# use std::sync::atomic::{AtomicBool, AtomicUsize};

0 commit comments

Comments
 (0)