I'm not sure about the need for this solution, so it's a **DRAFT**. For me it is an academic interest to check whether atomic locks will give advantages over pthread_mutex in games. Need to think about tests that can actually be measured.
Before build need define `USE_AFL`.
```bash export CFLAGS="${CFLAGS} -DUSE_AFL" ```
Old: https://gitlab.winehq.org/wine/wine/-/merge_requests/6031
v2 Changes: - Implemented different types of mutexes, and converted the code to use gcc extensions instead of C11. - Added tests and implemented as a separate library for testing. For tests, need to disable cpufreq scheduler and any power management, otherwise the tests will be unstable. https://github.com/h0tc0d3/afl - Depending on the processor, a regular mutex can be slightly faster or slightly slower. The recursive mutex used in ntdll is more than 2 times faster, and slightly faster with a simple lock-unlock.
TODO: - Condvar and RWlocks. With condvar there is a problem of preemption of lower priority threads by a higher priority thread. PI mutex allows to avoid this and takes into account the order, but works much slower. It is not yet entirely clear which condvar is better to use in wine. https://sourceware.org/bugzilla/show_bug.cgi?id=11588 https://static.lwn.net/images/conf/rtlws11/papers/proc/p10.pd
- Try to speed up windows synchronization primitives. At this point, I don't quite understand how this works and why the ntsync implementation uses server and vanilla wine doesn't. I would appreciate any help if it would be possible to improve the performance of synchronization primitives by implementing atomic structures.