Skip to content

Instantly share code, notes, and snippets.

View fantix's full-sized avatar
🤯

Fantix King fantix

🤯
View GitHub Profile
@fantix
fantix / main.rs
Last active November 7, 2022 22:58 — forked from divi255/main.rs
Test Rust shared resource guards
#[macro_use]
extern crate lazy_static;
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
use std::thread::sleep;
use std::time::Duration;
static READERS: u64 = 100;
static WRITERS: u64 = 2;
static RUNNING: AtomicBool = AtomicBool::new(true);