mirror of
https://github.com/LMMS/lmms.git
synced 2026-02-25 02:38:32 -05:00
C++11 (and subsequent C++ standards) provide portable ways to issue atomic hardware instructions, which allow multiple threads to load, store, and modify integers without taking a lock. The standard also defines a memory model that lets you express the ordering guarantees around these atomic operations. (x86 is relatively strongly-ordered, but many other common architectures, such as ARM, are free to reorder loads and stores unless told not to.) This patch removes the lock from shared_object and replaces it with the standard thread-safe reference counting implementation used in C++'s std::shared_ptr, Rust's std::sync::Arc, and many others. Additional resources on the topic: https://assets.bitbashing.io/papers/concurrency-primer.pdf https://www.youtube.com/watch?v=ZQFzMfHIxng
2.5 KiB
2.5 KiB