pub fn with_barriers<T, F>(f: F) -> Twhere F: FnOnce() -> T,
Execute a closure with memory barriers before and after