Kernel: Fix checking BlockResult

We now have BlockResult::WokeNormally and BlockResult::NotBlocked,
both of which indicate no error. We can no longer just check for
BlockResult::WokeNormally and assume anything else must be an
interruption.
This commit is contained in:
Tom 2020-07-06 17:10:52 -06:00 committed by Andreas Kling
commit 419703a1f2
Notes: sideshowbarker 2024-07-19 05:02:33 +09:00
7 changed files with 56 additions and 27 deletions

View file

@ -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>