github sammycage/plutovg v1.2.0

latest releases: v1.3.3, v1.3.2, v1.3.1...
16 months ago

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, and InterlockedCompareExchange are used for efficient, lock-free atomic operations on reference counts.
    • On C11-compliant platforms with <stdatomic.h>, atomic_fetch_add, atomic_fetch_sub, and atomic_load are used.
    • A fallback implementation using plain int is provided for platforms without atomic support (non-thread-safe).
  • Mutex Abstraction:

    • On Windows, CRITICAL_SECTION is used to implement recursive mutexes.
    • On C11 platforms with <threads.h>, mtx_t and mtx_recursive are used.
    • A no-op implementation is included for unsupported platforms, allowing builds to proceed without thread safety.

These changes lay the foundation for making plutovg safe to use in multi-threaded environments, improving robustness for concurrent applications.

Don't miss a new plutovg release

NewReleases is sending notifications on new releases.