rustc_data_structures/
flock.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//! Simple file-locking apis for each OS.
//!
//! This is not meant to be in the standard library, it does nothing with
//! green/native threading. This is just a bare-bones enough solution for
//! librustdoc, it is not production quality at all.

#[cfg(bootstrap)]
cfg_match! {
    cfg(target_os = "linux") => {
        mod linux;
        use linux as imp;
    }
    cfg(target_os = "redox") => {
        mod linux;
        use linux as imp;
    }
    cfg(unix) => {
        mod unix;
        use unix as imp;
    }
    cfg(windows) => {
        mod windows;
        use self::windows as imp;
    }
    _ => {
        mod unsupported;
        use unsupported as imp;
    }
}

#[cfg(not(bootstrap))]
cfg_match! {
    target_os = "linux" => {
        mod linux;
        use linux as imp;
    }
    target_os = "redox" => {
        mod linux;
        use linux as imp;
    }
    unix => {
        mod unix;
        use unix as imp;
    }
    windows => {
        mod windows;
        use self::windows as imp;
    }
    _ => {
        mod unsupported;
        use unsupported as imp;
    }
}

pub use imp::Lock;