Split find_best_thread() into two functions
commitec8ef12310886f8dae440b616a2f7eb60602d141
authorJiří Zárevúcky <zarevucky.jiri@gmail.com>
Wed, 19 Apr 2023 09:31:02 +0000 (19 11:31 +0200)
committerJiří Zárevúcky <zarevucky.jiri@gmail.com>
Wed, 19 Apr 2023 09:31:02 +0000 (19 11:31 +0200)
treec110bc8160f9c090d5cfe479b469c353f1d64031
parent117ad5a23def46f16848a3bd0a7168021c762d3c
Split find_best_thread() into two functions

try_find_thread() attempts to get a thread from runqueues and returns
NULL when there's none available. find_best_thread() functions as
before and goes to sleep between attempts to find a thread to run.

The purpose of this split is that we can use the non-sleeping version
in the context of a previously running thread to avoid an additional
context switch in case new thread is immediately available.
kernel/generic/src/proc/scheduler.c