src/common/SimpleMutex.h


Log

Author Commit Date CI Message
Shahbaz Youssefi 97cb3eb8 2024-04-16T10:25:49 Split ASSERT and logs into separate header This is because SimpleMutex.h wants to ASSERT, which was defined in debug.h. That file has a function that returns a reference to a mutex that would eventually be changed to SimpleMutex. The circular dependency cannot be resolved with a forward declaration with SimpleMutex being defined with `using`. Bug: angleproject:8667 Change-Id: I9a3acb6d07c6702048b47a72d8411b0fc2166922 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5458631 Reviewed-by: Roman Lavrov <romanl@google.com> Commit-Queue: Roman Lavrov <romanl@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi d9d583bf 2024-04-15T00:24:47 Implement a lock/unlock-only mutex based on futex Pthread mutexes are expensive due to their numerous features. When a mutex only needs to support lock and unlock, its implementation can be much simpler. The implementation in this change is "inspired" by a similar mutex in mesa. Expected uses of this mutex are: - Allowing some OpenGL calls to avoid the share group lock and instead lock the specific shared object they operate on. - Replacing SpinLock in the OpenCL implementation (spin-lock in user space is a bad idea [1]) - Generally anywhere we use std::mutex just to do lock/unlock Tests based on patch authored by Igor Nazarov <i.nazarov@samsung.com> [1]:https://www.realworldtech.com/forum/?threadid=189711&curpostid=189723 Bug: angleproject:8667 Change-Id: I52278c9d19616338c499bbcef6684746caead6ca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5446558 Reviewed-by: Roman Lavrov <romanl@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>