Fix race condition: use atomic_load in print_progress

This commit is contained in:
Bitshifter-9 2025-12-03 03:28:40 +05:30
parent 1bb140818a
commit 48d4a5377f

View File

@ -31,8 +31,8 @@ void after(uv_work_t *req, int status) {
}
void print_progress(uv_async_t *handle) {
double percentage = *((double *)handle->data);
fprintf(stderr, "Downloaded %.2f%%\n", percentage);
double pct = atomic_load_explicit(&percentage, memory_order_acquire);
fprintf(stderr, "Downloaded %.2f%%\n", pct);
}
int main() {