Update progress example

This commit is contained in:
Bitshifter-9 2025-12-03 03:44:39 +05:30
parent 694645cd40
commit c5d71c8187

View File

@ -13,6 +13,7 @@ _Atomic double percentage;
void fake_download(uv_work_t *req) { void fake_download(uv_work_t *req) {
int size = *((int*) req->data); int size = *((int*) req->data);
int downloaded = 0; int downloaded = 0;
double pct;
while (downloaded < size) { while (downloaded < size) {
pct = downloaded * 100.0 / size; pct = downloaded * 100.0 / size;
atomic_store_explicit(&percentage, pct, memory_order_release); atomic_store_explicit(&percentage, pct, memory_order_release);