v1.2.0
Make plutovg Thread-Safe with Atomic Ops and Mutexes
This release introduces platform-specific implementations of atomic reference counting and mutex primitives, making plutovg objects thread-safe across supported systems.
Key Additions:
-
Atomic Reference Counting:
- On Windows (
_WIN32),InterlockedIncrement,InterlockedDecrement, andInterlockedCompareExchangeare used for efficient, lock-free atomic operations on reference counts. - On C11-compliant platforms with
<stdatomic.h>,atomic_fetch_add,atomic_fetch_sub, andatomic_loadare used. - A fallback implementation using plain
intis provided for platforms without atomic support (non-thread-safe).
- On Windows (
-
Mutex Abstraction:
- On Windows,
CRITICAL_SECTIONis used to implement recursive mutexes. - On C11 platforms with
<threads.h>,mtx_tandmtx_recursiveare used. - A no-op implementation is included for unsupported platforms, allowing builds to proceed without thread safety.
- On Windows,
These changes lay the foundation for making plutovg safe to use in multi-threaded environments, improving robustness for concurrent applications.