@@ -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,12 @@ 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 processes, so it
35
+ /// cannot support non-blocking mode.
36
+ ///
37
+ /// If it is set to `Some`, then it can only go from
38
+ /// `Some(false)` -> `Some(true)` but not the other way around,
39
+ /// since that could cause a race condition.
32
40
is_non_blocking : Option < AtomicBool > ,
33
41
}
34
42
@@ -115,6 +123,10 @@ impl Client {
115
123
let path = Path :: new ( path_str) ;
116
124
117
125
let open_file = || {
126
+ // Opening with read write is necessary, since opening with
127
+ // read-only or write-only could block the thread until another
128
+ // thread opens it with write-only or read-only (or RDWR)
129
+ // correspondingly.
118
130
OpenOptions :: new ( )
119
131
. read ( true )
120
132
. write ( true )
0 commit comments