@@ -17,6 +17,10 @@ use std::thread::{self, Builder, JoinHandle};
17
17
use std:: time:: Duration ;
18
18
19
19
#[ derive( Debug ) ]
20
+ /// This preserves the `--jobserver-auth` type at creation time,
21
+ /// so auth type will be passed down to and inherit from sub-Make processes correctly.
22
+ ///
23
+ /// See <https://github.com/rust-lang/jobserver-rs/issues/99> for details.
20
24
enum ClientCreationArg {
21
25
Fds { read : c_int , write : c_int } ,
22
26
Fifo ( Box < Path > ) ,
@@ -27,8 +31,11 @@ pub struct Client {
27
31
read : File ,
28
32
write : File ,
29
33
creation_arg : ClientCreationArg ,
30
- /// it can only go from Some(false) -> Some(true) but not the other way around, since that
31
- /// could cause a race condition.
34
+ /// It is set to `None` if the pipe is shared with other processesdoes so it cannot support
35
+ /// non-blocking mode.
36
+ ///
37
+ /// If it is set to `Some`, then It can only go from `Some(false)` -> `Some(true)` but not
38
+ /// the other way around, since that could cause a race condition.
32
39
is_non_blocking : Option < AtomicBool > ,
33
40
}
34
41
@@ -115,6 +122,9 @@ impl Client {
115
122
let path = Path :: new ( path_str) ;
116
123
117
124
let open_file = || {
125
+ // Open with read write is necessary, since open with read-only or
126
+ // write-only could block the thread until another thread open it
127
+ // with write-only or read-only (or RDWR) correspondingly.
118
128
OpenOptions :: new ( )
119
129
. read ( true )
120
130
. write ( true )
0 commit comments