mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-25 21:19:35 +01:00
ritc-sync: Fix make_channel forcing dependency into user crate
Before, `make_channel` assumed that `critical_section` would be available in the namespace of the code that invoked the macro. Access `critical_section` through `rtic-sync` instead.
This commit is contained in:
parent
bca8f0815b
commit
609f14b1e4
2 changed files with 5 additions and 1 deletions
|
@ -13,6 +13,8 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top!
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- `make_channel` no longer requires the user crate to have `critical_section` in scope
|
||||||
|
|
||||||
## [v1.0.1] - 2023-06-14
|
## [v1.0.1] - 2023-06-14
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -9,6 +9,8 @@ use core::{
|
||||||
sync::atomic::{fence, Ordering},
|
sync::atomic::{fence, Ordering},
|
||||||
task::{Poll, Waker},
|
task::{Poll, Waker},
|
||||||
};
|
};
|
||||||
|
#[doc(hidden)]
|
||||||
|
pub use critical_section;
|
||||||
use heapless::Deque;
|
use heapless::Deque;
|
||||||
use rtic_common::waker_registration::CriticalSectionWakerRegistration as WakerRegistration;
|
use rtic_common::waker_registration::CriticalSectionWakerRegistration as WakerRegistration;
|
||||||
use rtic_common::{
|
use rtic_common::{
|
||||||
|
@ -108,7 +110,7 @@ macro_rules! make_channel {
|
||||||
|
|
||||||
static CHECK: ::core::sync::atomic::AtomicU8 = ::core::sync::atomic::AtomicU8::new(0);
|
static CHECK: ::core::sync::atomic::AtomicU8 = ::core::sync::atomic::AtomicU8::new(0);
|
||||||
|
|
||||||
critical_section::with(|_| {
|
$crate::channel::critical_section::with(|_| {
|
||||||
if CHECK.load(::core::sync::atomic::Ordering::Relaxed) != 0 {
|
if CHECK.load(::core::sync::atomic::Ordering::Relaxed) != 0 {
|
||||||
panic!("call to the same `make_channel` instance twice");
|
panic!("call to the same `make_channel` instance twice");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue