You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/job_token.rs
+9-6Lines changed: 9 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -19,17 +19,20 @@ impl Drop for JobToken {
19
19
20
20
implJobToken{
21
21
/// Ensure that this token is not put back into queue once it's dropped.
22
-
/// This also leads to releasing it sooner for other processes to use, which is a good thing to do once you know that
23
-
/// you're never going to request a token in this process again.
22
+
/// This also leads to releasing it sooner for other processes to use,
23
+
/// which is a correct thing to do once it is known that there won't be
24
+
/// any more token acquisitions.
24
25
pub(crate)fnforget(&mutself){
25
26
self.should_return_to_queue = false;
26
27
}
27
28
}
28
29
29
30
/// A thin wrapper around jobserver's Client.
30
-
/// It would be perfectly fine to just use that, but we also want to reuse our own implicit token assigned for this build script.
31
-
/// This struct manages that and gives out tokens without exposing whether they're implicit tokens or tokens from jobserver.
32
-
/// Furthermore, instead of giving up job tokens, it keeps them around for reuse if we know we're going to request another token after freeing the current one.
31
+
/// It would be perfectly fine to just use jobserver's Client, but we also want to reuse
32
+
/// our own implicit token assigned for this build script. This struct manages that and
33
+
/// gives out tokens without exposing whether they're implicit tokens or tokens from jobserver.
34
+
/// Furthermore, instead of giving up job tokens, it keeps them around
35
+
/// for reuse if we know we're going to request another token after freeing the current one.
33
36
pub(crate)structJobTokenServer{
34
37
helper:HelperThread,
35
38
tx:Sender<Option<Acquired>>,
@@ -51,7 +54,7 @@ impl JobTokenServer {
51
54
52
55
pub(crate)fnacquire(&mutself) -> JobToken{
53
56
let token = ifletOk(token) = self.rx.try_recv(){
54
-
// Opportunistically check if we already have a token for our own reuse.
57
+
// Opportunistically check if there's a token that can be reused.
Copy file name to clipboardExpand all lines: src/lib.rs
+5-3Lines changed: 5 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1342,9 +1342,11 @@ impl Build {
1342
1342
loop{
1343
1343
letmut has_made_progress = false;
1344
1344
// If the other end of the pipe is already disconnected, then we're not gonna get any new jobs,
1345
-
// so it doesn't make sense to reuse the tokens; in fact, releasing them as soon as possible (once we know that the other end is disconnected) is beneficial.
1346
-
// Imagine that the last file built takes an hour to finish; in this scenario, by not releasing the tokens before other builds are done we'd effectively block other processes from
1347
-
// starting sooner - even though we only need one token, not however many we've acquired.
1345
+
// so it doesn't make sense to reuse the tokens; in fact,
1346
+
// releasing them as soon as possible (once we know that the other end is disconnected) is beneficial.
1347
+
// Imagine that the last file built takes an hour to finish; in this scenario,
1348
+
// by not releasing the tokens before that last file is done we would effectively block other processes from
1349
+
// starting sooner - even though we only need one token for that last file, not N others that were acquired.
0 commit comments