[K/N][Runtime] Support suspending mutators in the new MM

This commit is contained in:
Ilya Matveev
2021-05-31 09:48:46 +00:00
committed by Space
parent 94a94a557d
commit de5dcfcbd8
11 changed files with 466 additions and 12 deletions
@@ -17,6 +17,7 @@
#ifndef RUNTIME_MEMORY_H
#define RUNTIME_MEMORY_H
#include <ostream>
#include <utility>
#include "KAssert.h"
@@ -410,12 +411,17 @@ ALWAYS_INLINE ThreadState SwitchThreadState(MemoryState* thread, ThreadState new
// Asserts that the given thread is in the given state.
ALWAYS_INLINE void AssertThreadState(MemoryState* thread, ThreadState expected) noexcept;
ALWAYS_INLINE void AssertThreadState(MemoryState* thread, std::initializer_list<ThreadState> expected) noexcept;
// Asserts that the current thread is in the the given state.
ALWAYS_INLINE inline void AssertThreadState(ThreadState expected) noexcept {
AssertThreadState(mm::GetMemoryState(), expected);
}
ALWAYS_INLINE inline void AssertThreadState(std::initializer_list<ThreadState> expected) noexcept {
AssertThreadState(mm::GetMemoryState(), expected);
}
// Scopely sets the given thread state for the given thread.
class ThreadStateGuard final : private Pinned {
public: