You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit resolves a data race issue identified by ThreadSanitizer.
Most of the data race instances are rectified by implementing atomic
operations to synchronize counter and status variables. While several
fixes are straightforward, some require careful consideration due to
potential deviations from the original behavior.
The primary data race scenario pertains to the manipulation of the
random seed. To enhance thread independence, a thread-local storage
variable is now utilized to manage individual thread seeds effectively.
Another complex challenge involves preventing a race condition between
the writer thread, responsible for removal, and other reader threads.
This situation poses a risk of freeing memory that readers are still
using, resulting in use-after-free bugs. In pursuit of a practical yet
efficient solution, a basic approach has been adopted: maintaining a
linked list of pending memory releases. This memory is retained until
the program's termination. Although not the most sophisticated method,
it ensures correctness within the context of this project's aim to
provide a user-friendly example.
These changes collectively enhance the stability and reliability of
the codebase while addressing the reported data race concerns.
0 commit comments