@@ -17,6 +17,10 @@ use std::thread::{self, Builder, JoinHandle};
1717use std:: time:: Duration ;
1818
1919#[ 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.
2024enum ClientCreationArg {
2125 Fds { read : c_int , write : c_int } ,
2226 Fifo ( Box < Path > ) ,
@@ -27,8 +31,11 @@ pub struct Client {
2731 read : File ,
2832 write : File ,
2933 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.
3239 is_non_blocking : Option < AtomicBool > ,
3340}
3441
@@ -115,6 +122,9 @@ impl Client {
115122 let path = Path :: new ( path_str) ;
116123
117124 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.
118128 OpenOptions :: new ( )
119129 . read ( true )
120130 . write ( true )
0 commit comments