1pub use ctrlc;
12pub use futex_queue as mpsc;
13pub use lazy_static;
14pub use linux_rtic_macros::app;
15pub use pcp_mutex::PcpMutex;
16pub use rtic_core::{prelude as mutex_prelude, Exclusive, Mutex};
17
18use std::cell::UnsafeCell;
19
20#[cfg(feature = "profiling")]
21pub use tracing;
22#[cfg(feature = "profiling")]
23pub use tracing_chrome;
24#[cfg(feature = "profiling")]
25pub use tracing_subscriber;
26
27pub mod slab;
28
29pub fn init_thread_state(priority: pcp_mutex::Priority) {
30 #[cfg(feature = "rt")]
31 pcp_mutex::thread::init_fifo_priority(priority).expect("Error setting thread priority");
32}
33
34#[repr(transparent)]
36pub struct RacyCell<T>(UnsafeCell<T>);
37
38impl<T> RacyCell<T> {
39 #[inline(always)]
41 pub const fn new(value: T) -> Self {
42 RacyCell(UnsafeCell::new(value))
43 }
44
45 #[inline(always)]
47 pub unsafe fn get_mut_unchecked(&self) -> &mut T {
48 &mut *self.0.get()
49 }
50
51 #[inline(always)]
53 pub unsafe fn get_unchecked(&self) -> &T {
54 &*self.0.get()
55 }
56}
57
58unsafe impl<T> Sync for RacyCell<T> {}