about summary refs log tree commit diff
path: root/library/std/src/sync/mpmc/tests.rs
blob: 6deb4dc2fe0cc16bc94080ecba3495dc08b9ecf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Ensure that thread_local init with `const { 0 }` still has unique address at run-time
#[test]
fn waker_current_thread_id() {
    let first = super::waker::current_thread_id();
    let t = crate::thread::spawn(move || {
        let second = super::waker::current_thread_id();
        assert_ne!(first, second);
        assert_eq!(second, super::waker::current_thread_id());
    });

    assert_eq!(first, super::waker::current_thread_id());
    t.join().unwrap();
    assert_eq!(first, super::waker::current_thread_id());
}