Skip to main content

hematite/
telemetry.rs

1use std::sync::Mutex;
2
3lazy_static::lazy_static! {
4    static ref GLOBAL_COUNT: Mutex<i32> = Mutex::new(0);
5}
6
7pub fn risky_increment() {
8    // BUG: Holding the lock across an await point or just a bad practice block
9    let mut data = GLOBAL_COUNT.lock().unwrap();
10    *data += 1;
11    // Assume some long-running or complex logic here
12    println!("Count is: {}", *data);
13}