diff options
| author | Jon Gjengset <jon@thesquareplanet.com> | 2017-04-07 09:13:06 -0400 |
|---|---|---|
| committer | Jon Gjengset <jon@thesquareplanet.com> | 2017-04-07 09:13:06 -0400 |
| commit | e6597e12bc40a28ed4c682e71f7159b9cb2403e7 (patch) | |
| tree | aca9daaf5c6725c698dfe0a867c0926aa637be7a | |
| parent | 8fc3ab20b01044cfebfcd963ef7b69cdb11381b2 (diff) | |
| download | rust-e6597e12bc40a28ed4c682e71f7159b9cb2403e7.tar.gz rust-e6597e12bc40a28ed4c682e71f7159b9cb2403e7.zip | |
Mention interrupts and green threads
| -rw-r--r-- | src/doc/unstable-book/src/compiler-barriers.md | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/doc/unstable-book/src/compiler-barriers.md b/src/doc/unstable-book/src/compiler-barriers.md index df0e20eefad..9e137a5c4f8 100644 --- a/src/doc/unstable-book/src/compiler-barriers.md +++ b/src/doc/unstable-book/src/compiler-barriers.md @@ -32,7 +32,12 @@ racing *with itself*. That is, if a given thread is executing one piece of code, and is then interrupted, and starts executing code elsewhere (while still in the same thread, and conceptually still on the same core). In traditional programs, this can only occur when a signal -handler is registered. Consider the following code: +handler is registered. In more low-level code, such situations can also +arise when handling interrupts, when implementing green threads with +pre-emption, etc. + +To give a straightforward example of when a `compiler_barrier` is +necessary, consider the following example: ```rust # use std::sync::atomic::{AtomicBool, AtomicUsize}; |
