Kernel: Remove obsolete Scheduler::is_valid_tid()
This function was used when processes could die at any point in time. Now that processes can only die in known spots, we can be sure they are not holding any locks. This allows much more performant locking.
This commit is contained in:
parent
12474addda
commit
2e858fddb5
|
@ -29,8 +29,6 @@ namespace Kernel
|
||||||
Thread& current_thread();
|
Thread& current_thread();
|
||||||
static pid_t current_tid();
|
static pid_t current_tid();
|
||||||
|
|
||||||
static bool is_valid_tid(pid_t tid);
|
|
||||||
|
|
||||||
[[noreturn]] void execute_current_thread();
|
[[noreturn]] void execute_current_thread();
|
||||||
[[noreturn]] void _execute_current_thread();
|
[[noreturn]] void _execute_current_thread();
|
||||||
[[noreturn]] void delete_current_process_and_thread();
|
[[noreturn]] void delete_current_process_and_thread();
|
||||||
|
|
|
@ -378,26 +378,4 @@ namespace Kernel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Scheduler::is_valid_tid(pid_t tid)
|
}
|
||||||
{
|
|
||||||
CriticalScope _;
|
|
||||||
|
|
||||||
if (s_instance == nullptr)
|
|
||||||
return tid == 0;
|
|
||||||
|
|
||||||
for (auto& thread : s_instance->m_active_threads)
|
|
||||||
if (thread.thread->tid() == tid)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
for (auto& thread : s_instance->m_sleeping_threads)
|
|
||||||
if (thread.thread->tid() == tid)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
for (auto& thread : s_instance->m_blocking_threads)
|
|
||||||
if (thread.thread->tid() == tid)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace Kernel
|
||||||
{
|
{
|
||||||
CriticalScope _;
|
CriticalScope _;
|
||||||
ASSERT(m_locker != tid);
|
ASSERT(m_locker != tid);
|
||||||
if (m_locker == -1 || !Scheduler::is_valid_tid(m_locker))
|
if (m_locker == -1)
|
||||||
{
|
{
|
||||||
m_locker = tid;
|
m_locker = tid;
|
||||||
break;
|
break;
|
||||||
|
@ -48,7 +48,7 @@ namespace Kernel
|
||||||
m_lock_depth++;
|
m_lock_depth++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (m_locker == -1 || !Scheduler::is_valid_tid(m_locker))
|
if (m_locker == -1)
|
||||||
{
|
{
|
||||||
m_locker = tid;
|
m_locker = tid;
|
||||||
m_lock_depth = 1;
|
m_lock_depth = 1;
|
||||||
|
|
Loading…
Reference in New Issue