Commit 3fcabb6
wasm-mutate-stats: release worklist mutex before file I/O (#2491)
The writer thread popped from the to_write queue with
if let Some(wasm) = to_write_clone.lock().unwrap().pop() {
std::fs::write(filename, &wasm)?;
}
The temporary MutexGuard returned by .lock() lives for the entire
'if let' / 'while let' body, so the queue mutex stayed held across
each std::fs::write call, blocking the producer thread (and shutdown)
on every file write.
Hoist the .pop() into its own statement so the guard is dropped
before the I/O, then match on the resulting Option in a separate
scope. Cargo check on -p wasm-mutate-stats stays green.
Co-authored-by: SAY-5 <saiasish.cnp@gmail.com>1 parent 99a4c68 commit 3fcabb6
1 file changed
Lines changed: 11 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
456 | | - | |
457 | | - | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
458 | 463 | | |
459 | 464 | | |
460 | 465 | | |
461 | 466 | | |
462 | 467 | | |
463 | 468 | | |
464 | | - | |
465 | | - | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
466 | 473 | | |
467 | | - | |
468 | 474 | | |
469 | 475 | | |
470 | 476 | | |
| |||
0 commit comments