#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
use std::sync::atomic::{AtomicBool, Ordering};
static HAVE_TOKEN : AtomicBool = AtomicBool::new(true);
pub struct ThreadUnsafetyToken(());
impl ThreadUnsafetyToken {
pub fn take() -> Option<Self> {
if HAVE_TOKEN.swap(false, Ordering::SeqCst) {
Some(ThreadUnsafetyToken(()))
} else {
None
}
}
}
impl Drop for ThreadUnsafetyToken {
fn drop(&mut self) {
if HAVE_TOKEN.swap(true, Ordering::SeqCst) {
panic!("Tried to drop ThreadUnsafetyToken back but we're also holding one. Something is very wrong and UB is likely!")
} else {
()
}
}
}
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
#[cfg(test)]
mod tests;
#[cfg(test)]
#[macro_use]
extern crate lazy_static;
#[cfg(test)]
extern crate semver_parser;