mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:28:12 +00:00
Kernel: More PID/TID typing
This commit is contained in:
parent
7bdf54c837
commit
bee08a4b9f
21 changed files with 67 additions and 60 deletions
|
@ -44,7 +44,7 @@ public:
|
|||
void unlock();
|
||||
|
||||
private:
|
||||
Atomic<int> m_holder { 0 };
|
||||
Atomic<pid_t> m_holder { 0 };
|
||||
u32 m_level { 0 };
|
||||
};
|
||||
|
||||
|
@ -65,14 +65,14 @@ private:
|
|||
|
||||
ALWAYS_INLINE void Lock::lock()
|
||||
{
|
||||
int tid = gettid();
|
||||
pid_t tid = gettid();
|
||||
if (m_holder == tid) {
|
||||
++m_level;
|
||||
return;
|
||||
}
|
||||
for (;;) {
|
||||
int expected = 0;
|
||||
if (m_holder.compare_exchange_strong(expected, tid, AK::memory_order_acq_rel)) {
|
||||
if (m_holder.compare_exchange_strong(expected, tid, AK::memory_order_acq_rel)) {
|
||||
m_level = 1;
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue