mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-08 01:27:31 +00:00
Kernel: Add a basic thread boosting mechanism
This patch introduces a syscall:
int set_thread_boost(int tid, int amount)
You can use this to add a permanent boost value to the effective thread
priority of any thread with your UID (or any thread in the system if
you are the superuser.)
This is quite crude, but opens up some interesting opportunities. :^)
This commit is contained in:
@@ -786,3 +786,15 @@ void Thread::wake_from_queue()
|
||||
ASSERT(state() == State::Queued);
|
||||
set_state(State::Runnable);
|
||||
}
|
||||
|
||||
Thread* Thread::from_tid(int tid)
|
||||
{
|
||||
ASSERT_INTERRUPTS_DISABLED();
|
||||
Thread* found_thread = nullptr;
|
||||
Thread::for_each([&](auto& thread) {
|
||||
if (thread.tid() == tid)
|
||||
found_thread = &thread;
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
return found_thread;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user