Commit 1ee720c
fix(download): serialize the user progress callback across chunk workers
The per-chunk progress path (per_chunk_progress -> options.progress) could be
entered concurrently by up to max_concurrency (default 64) chunk worker threads,
but the public download progress API does not require the caller's callback to
be thread-safe. A typical callback that updates a counter, UI handle, or logger
would data-race. Guard the user callback invocation with a mutex so it is never
re-entered concurrently; the atomics that compute the percentage are unchanged.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 42a7737 commit 1ee720c
1 file changed
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
504 | 504 | | |
505 | 505 | | |
506 | 506 | | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
507 | 514 | | |
508 | 515 | | |
509 | 516 | | |
| |||
528 | 535 | | |
529 | 536 | | |
530 | 537 | | |
531 | | - | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
532 | 543 | | |
533 | 544 | | |
534 | 545 | | |
| |||
0 commit comments