-
Simon McVittie authored
On Unix, dbus has historically used gcc-specific lock-free atomic intrinsics where available, falling back to a pthreads mutex where possible. Meanwhile, on Windows, it has historically used InterlockedIncrement() and similar library functions (in practice wrappers around lock-free intrinsics on real Windows, but IPC calls into wineserver on Wine). ISO C11 provides a new header, stdatomic.h, with standardized support for atomic operations. Exactly how these are implemented is a compiler quality-of-implementation decision, but any reasonable compiler implementation on a modern CPU should be using intrinsics. Let's use this wherever possible, falling back to our old implementation only if the C11 implementation is unsupported. One concrete benefit that we get from this is that when compiling with mingw-w64 gcc and running via Wine, this makes atomic reference counting operations into a simple local operation, rather than IPC to wineserver which can be very slow....
88b57499