Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/rust/parking_lot/tests/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 380 B image not shown  

Quelle  issue_203.rs   Sprache: unbekannt

 
use parking_lot::RwLock;
use std::thread;

struct Bar(RwLock<()>);

impl Drop for Bar {
    fn drop(&mut self) {
        let _n = self.0.write();
    }
}

thread_local! {
    static B: Bar = Bar(RwLock::new(()));
}

#[test]
fn main() {
    thread::spawn(|| {
        B.with(|_| ());

        let a = RwLock::new(());
        let _a = a.read();
    })
    .join()
    .unwrap();
}

[ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet)  ]