Replace accidental rs code blocks with rust

pull/378/head
SabrinaJewson 2 years ago
parent 42f46d2054
commit 46f31aeaab
No known key found for this signature in database
GPG Key ID: 3D5438FFA5F05564

@ -15,7 +15,7 @@ However, while no global ordering of operations exists _between_ threads, there
does exist a single total ordering _within_ each thread, which is known as its
_sequence_. For example, given this simple Rust program:
```rs
```rust
println!("A");
println!("B");
```
@ -39,7 +39,7 @@ happen one after the other and on the same thread.
If we add a second thread to the mix:
```rs
```rust
// Thread 1:
println!("A");
println!("B");
@ -71,7 +71,7 @@ is.
Now lets make things more interesting by introducing some shared data, and have
both threads read it.
```rs
```rust
// Initial state
let data = 0;
// Thread 1:
@ -101,7 +101,7 @@ return to a single thread, just to keep things simple).
Consider this code, which were going to attempt to draw a diagram for like
above:
```rs
```rust
let mut data = 0;
data = 1;
data;

@ -4,9 +4,9 @@ Now weve got single-threaded mutation semantics out of the way, we can try
reintroducing a second thread. Well have one thread perform a write to the
memory location, and a second thread read from it, like so:
```rs
```rust
// Initial state
let mut state = 0;
let mut data = 0;
// Thread 1:
data = 1;
// Thread 2:

@ -193,7 +193,7 @@ happens before the other. Any such data race results in undefined behavior.
## Atomic orderings
```rs
```rust
// in ::core::sync::atomic
#[non_exhaustive]
pub enum Ordering {
@ -269,7 +269,7 @@ Implementations should ensure that no “out-of-thin-air” values are computed
circularly depend on their own computation.
> _Note 6_: For example, with `x` and `y` initially zero,
> ```rs
> ```rust,ignore
> // Thread 1:
> let r1 = y.load(atomic::Ordering::Relaxed);
> x.store(r1, atomic::Ordering::Relaxed);
@ -284,7 +284,7 @@ circularly depend on their own computation.
> _Note 7_: The recommendation similarly disallows `r1 == r2 == 42` in the
> following example, with `x` and `y` again initially zero:
> ```rs
> ```rust,ignore
> // Thread 1:
> let r1 = x.load(atomic::Ordering::Relaxed);
> if r1 == 42 {
@ -328,7 +328,7 @@ synchronizes with an acquire fence _B_ if there exists some atomic operation _X_
on _M_ such that _X_ is sequenced before _B_ and reads the value written by _A_
or a value written by any side effect in the release sequence headed by _A_.
```rs
```rust,ignore
pub fn fence(order: Ordering);
```
@ -339,7 +339,7 @@ _Effects_: Depending on the value of `order`, this operation:
- is both an acquire and a release fence, if `order == AcqRel`;
- is a sequentially consistent acquire and release fence, if `order == SeqCst`.
```rs
```rust,ignore
pub fn compiler_fence(order: Ordering);
```

Loading…
Cancel
Save