[K/N][Runtime] Support thread state switching in spin locks

Issue #KT-49013 Fixed
This commit is contained in:
Ilya Matveev
2021-09-28 17:29:42 +07:00
committed by Space
parent bee44c6e0f
commit 629ea1036e
15 changed files with 223 additions and 50 deletions
@@ -18,8 +18,8 @@ using namespace kotlin;
namespace {
template <typename T>
KStdVector<T> Collect(MultiSourceQueue<T>& queue) {
template <typename T, typename Mutex>
KStdVector<T> Collect(MultiSourceQueue<T, Mutex>& queue) {
KStdVector<T> result;
for (const auto& element : queue.LockForIter()) {
result.push_back(element);
@@ -29,7 +29,7 @@ KStdVector<T> Collect(MultiSourceQueue<T>& queue) {
} // namespace
using IntQueue = MultiSourceQueue<int>;
using IntQueue = MultiSourceQueue<int, SpinLock<MutexThreadStateHandling::kIgnore>>;
TEST(MultiSourceQueueTest, Insert) {
IntQueue queue;