remove dead code in waker

This commit is contained in:
xoviat 2021-01-05 17:19:05 -06:00 committed by GitHub
parent f62eb66bf2
commit 7bee584808
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -308,56 +308,6 @@ compile_error!(
pub use stm32f4xx_hal as hal;
pub use stm32f4xx_hal::stm32 as pac;
/// Creates a new interrupt waking a [`Waker`].
///
/// As this interrupt will be declared in this macro, it can't be used for anything else.
///
/// # Examples
///
/// This macro is useful for implementing [`Future::poll`]:
///
/// ```
/// fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
/// if self.is_ready() {
/// Poll::Ready(())
/// } else {
/// waker_interrupt!(TIM2, cx.waker().clone());
/// Poll::Pending
/// }
/// }
/// ```
///
/// [`Waker`]: core::task::Waker
/// [`Future::poll`]: core::future::Future::poll
// macro_rules! waker_interrupt {
// ($INT:ident, $waker:expr) => {{
// use core::sync::atomic::{self, Ordering};
// use core::task::Waker;
// use stm32f4xx_hal::pac::{interrupt, Interrupt, NVIC};
//
// static mut WAKER: Option<Waker> = None;
//
// #[interrupt]
// fn $INT() {
// // Safety: This context is disabled while the lower priority context accesses WAKER
// if let Some(waker) = unsafe { WAKER.as_ref() } {
// waker.wake_by_ref();
//
// NVIC::mask(Interrupt::$INT);
// }
// }
//
// NVIC::mask(Interrupt::$INT);
// atomic::compiler_fence(Ordering::Acquire);
// // Safety: The other relevant context, the interrupt, is disabled
// unsafe { WAKER = Some($waker) }
// NVIC::unpend(Interrupt::$INT);
// atomic::compiler_fence(Ordering::Release);
// // Safety: This is the end of a mask-based critical section
// unsafe { NVIC::unmask(Interrupt::$INT) }
// }};
// }
// This mod MUST go first, so that the others see its macros.
pub(crate) mod fmt;