Kernel: Add is_locked() to spinlock
I think this is atomic read
This commit is contained in:
parent
01f267a321
commit
f6b05212e0
|
@ -14,7 +14,8 @@ namespace Kernel
|
||||||
SpinLock() = default;
|
SpinLock() = default;
|
||||||
void lock();
|
void lock();
|
||||||
void unlock();
|
void unlock();
|
||||||
|
bool is_locked() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_lock = 0;
|
int m_lock = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,4 +16,9 @@ namespace Kernel
|
||||||
spinlock_unlock_asm(&m_lock);
|
spinlock_unlock_asm(&m_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SpinLock::is_locked() const
|
||||||
|
{
|
||||||
|
return m_lock;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue