diff options
Diffstat (limited to 'Kernel/Thread.h')
-rw-r--r-- | Kernel/Thread.h | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/Kernel/Thread.h b/Kernel/Thread.h index e9b39161bd..50ffe54a1a 100644 --- a/Kernel/Thread.h +++ b/Kernel/Thread.h @@ -300,12 +300,42 @@ public: u64 sleep(u32 ticks); u64 sleep_until(u64 wakeup_time); - enum class BlockResult { - WokeNormally, - NotBlocked, - InterruptedBySignal, - InterruptedByDeath, - InterruptedByTimeout, + class BlockResult { + public: + enum Type { + WokeNormally, + NotBlocked, + InterruptedBySignal, + InterruptedByDeath, + InterruptedByTimeout, + }; + + BlockResult() = delete; + + BlockResult(Type type) + : m_type(type) + { + } + + bool operator==(Type type) const + { + return m_type == type; + } + + bool was_interrupted() const + { + switch (m_type) { + case InterruptedBySignal: + case InterruptedByDeath: + case InterruptedByTimeout: + return true; + default: + return false; + } + } + + private: + Type m_type; }; template<typename T, class... Args> |