Tweak a loop condition.
This loop condition involves `codegen_state`, `work_items`, and `running_with_own_token`. But the body of the loop cannot modify `codegen_state`, so repeatedly checking it is unnecessary.
This commit is contained in:
parent
d21d31cce7
commit
179bf19813
1 changed files with 11 additions and 7 deletions
|
@ -1431,13 +1431,17 @@ fn start_executing_work<B: ExtraBackendMethods>(
|
|||
|
||||
// Spin up what work we can, only doing this while we've got available
|
||||
// parallelism slots and work left to spawn.
|
||||
while codegen_state != Aborted
|
||||
&& !work_items.is_empty()
|
||||
&& running_with_own_token < tokens.len()
|
||||
{
|
||||
let (item, _) = work_items.pop().unwrap();
|
||||
spawn_work(&cgcx, &mut llvm_start_time, get_worker_id(&mut free_worker_ids), item);
|
||||
running_with_own_token += 1;
|
||||
if codegen_state != Aborted {
|
||||
while !work_items.is_empty() && running_with_own_token < tokens.len() {
|
||||
let (item, _) = work_items.pop().unwrap();
|
||||
spawn_work(
|
||||
&cgcx,
|
||||
&mut llvm_start_time,
|
||||
get_worker_id(&mut free_worker_ids),
|
||||
item,
|
||||
);
|
||||
running_with_own_token += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Relinquish accidentally acquired extra tokens.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue