Commit Graph

2 Commits

Author SHA1 Message Date
PRANAV KUMAR
048acb509c
doc: fix threading bugs in progress example (#4956)
Fixed race conditions and memory safety issues in the progress example
by using C11 atomic operations for proper thread synchronization.

Changes:
- Changed percentage from double to _Atomic double
- Use atomic_store_explicit() with memory_order_release when writing
- Use atomic_load_explicit() with memory_order_acquire when reading
- Removed unsafe pointer passing via async.data

This ensures proper memory synchronization between the worker thread
and async callback, preventing data races and dangling pointer issues.

Fixes #4386
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-16 22:36:18 -04:00
Saúl Ibarra Corretgé
d59d6e6f22 doc: add code samples from uvbook (unadapted)
PR-URL: https://github.com/libuv/libuv/pull/1246
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2017-04-28 11:16:15 +02:00