diff --git a/kotlin-native/runtime/src/main/cpp/Mutex.hpp b/kotlin-native/runtime/src/main/cpp/Mutex.hpp index 80545175b90..bcd3b3f7ff6 100644 --- a/kotlin-native/runtime/src/main/cpp/Mutex.hpp +++ b/kotlin-native/runtime/src/main/cpp/Mutex.hpp @@ -18,6 +18,7 @@ #define RUNTIME_MUTEX_H #include +#include #include "KAssert.h" #include "Memory.h" @@ -37,7 +38,7 @@ class SpinLock : private Pinned { public: void lock() noexcept { while (!__sync_bool_compare_and_swap(&atomicInt, 0, 1)) { - // TODO: yield. + std::this_thread::yield(); } } @@ -63,7 +64,7 @@ public: kotlin::NativeOrUnregisteredThreadGuard guard(/* reentrant = */ true); while (!__sync_bool_compare_and_swap(&atomicInt, 0, 1)) { - // TODO: yield. + std::this_thread::yield(); } }