diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2021-10-26 22:16:39 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2021-10-26 22:20:03 +0200 |
commit | c97871cdc864787d6ebf3e515f85a36ea994c16e (patch) | |
tree | 693864fe434f15ab8598b35e779d5570744c5d40 /crates/runner/src/lib.rs | |
parent | 53f68281958bea55f3c1ee5da055219014df108f (diff) | |
download | rebel-c97871cdc864787d6ebf3e515f85a36ea994c16e.tar rebel-c97871cdc864787d6ebf3e515f85a36ea994c16e.zip |
runner: move jobserver token handling into task process
We can avoid holding onto a token while waiting on a lock this way.
Abnormal exits that would make us lose tokens should not happen here; if
they do, the runner PID1 will stop the whole build, so a lost token does
not matter.
Diffstat (limited to 'crates/runner/src/lib.rs')
-rw-r--r-- | crates/runner/src/lib.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/runner/src/lib.rs b/crates/runner/src/lib.rs index 01ab85d..a300446 100644 --- a/crates/runner/src/lib.rs +++ b/crates/runner/src/lib.rs @@ -62,7 +62,6 @@ fn handle_request( request_socket: UnixStream, ) -> UnixSeqpacketConn { let child = |socket| { - let token = ctx.jobserver.wait(); let pid = unsafe { clone::spawn(None, (), |()| { drop(socket); @@ -80,9 +79,10 @@ fn handle_request( } .expect("fork()") .0; - let wait_res = wait::waitpid(pid, None); - ctx.jobserver.post(token); - wait_res.expect("waitpid()"); + wait::waitpid(pid, None) + .expect("waidpid()") + .check() + .unwrap(); }; let (pid, socket) = unsafe { clone::spawn(None, socket, child) }.expect("fork()"); |