[K/N] Do not check for external calls in SpinLock<Ignore>

Merge-request: KT-MR-7099
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
This commit is contained in:
Alexander Shabalin
2022-09-13 13:37:12 +00:00
committed by Space
parent 95c1892ef1
commit e6e7feb985
+4 -2
View File
@@ -36,13 +36,15 @@ class SpinLock;
template <>
class SpinLock<MutexThreadStateHandling::kIgnore> : private Pinned {
public:
void lock() noexcept {
// No need to check for external calls, because we explicitly ignore thread state.
NO_EXTERNAL_CALLS_CHECK void lock() noexcept {
while(flag_.test_and_set(std::memory_order_acquire)) {
std::this_thread::yield();
}
}
void unlock() noexcept {
// No need to check for external calls, because we explicitly ignore thread state.
NO_EXTERNAL_CALLS_CHECK void unlock() noexcept {
flag_.clear(std::memory_order_release);
}