Skip to content

Commit e867957

Browse files
committed
Point to a real-world example of an embedded critical section
1 parent 4cf15ea commit e867957

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/rust-2024/static-mut-references.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,9 @@ fn set_value(value: i32) {
332332

333333
The standard library has a nightly-only (unstable) variant of [`UnsafeCell`] called [`SyncUnsafeCell`]. This example above shows a very simplified version of the standard library type, but would be used roughly the same way. It can provide even better isolation, so do check out its implementation for more details.
334334

335+
This example includes a fictional `with_interrupts_disabled` function which is the type of thing you might see in an embedded environment. For example, the [`critical-section`] crate provides a similar kind of functionality that could be used for an embedded environment.
336+
337+
[`critical-section`]: https://crates.io/crates/critical-section
335338
[`UnsafeCell`]: ../../std/cell/struct.UnsafeCell.html
336339
[`SyncUnsafeCell`]: ../../std/cell/struct.SyncUnsafeCell.html
337340

0 commit comments

Comments
 (0)