forked from Bananymous/banan-os
Kernel: SpinLocks now reschedule if they cannot aquire the lock
This allows us to not actually spin doing nothing while waiting for another (not executing) to release the lock. This api won't probably work when we get to SMP
This commit is contained in:
parent
7da0627f8e
commit
97c7fc42d1
|
@ -8,7 +8,7 @@ namespace Kernel
|
|||
{
|
||||
while (__sync_lock_test_and_set(&m_lock, 1))
|
||||
while (m_lock)
|
||||
__builtin_ia32_pause();
|
||||
Scheduler::get().reschedule();
|
||||
}
|
||||
|
||||
void SpinLock::unlock()
|
||||
|
@ -27,10 +27,6 @@ namespace Kernel
|
|||
|
||||
while (true)
|
||||
{
|
||||
// Wait for us to be the locker or the lock being free
|
||||
while (m_locker != -1 && m_locker != tid)
|
||||
__builtin_ia32_pause();
|
||||
|
||||
m_lock.lock();
|
||||
if (m_locker == tid)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue