Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/mustatex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,18 @@ macro_rules! mustatex {
$viz mod $name {
use super::*;

static mut INNER: std::sync::Mutex<$Type> = std::sync::Mutex::new($init);
static INNER: std::sync::Mutex<$Type> = std::sync::Mutex::new($init);

pub fn set(x: $Type) {
unsafe {
*INNER.lock().unwrap() = x;
}
*INNER.lock().unwrap() = x;
}

pub fn get() -> impl std::ops::Deref<Target = $Type> {
unsafe { INNER.lock().unwrap() }
INNER.lock().unwrap()
}

pub fn get_mut() -> impl std::ops::DerefMut<Target = $Type> {
unsafe { INNER.lock().unwrap() }
INNER.lock().unwrap()
}
}
)*
Expand Down