mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:18:12 +00:00
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:
parent
1493dd9dc6
commit
419703a1f2
7 changed files with 56 additions and 27 deletions
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue