mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:57:35 +00:00
Kernel: Move some time related code from Scheduler into TimeManagement
Use the TimerQueue to expire blocking operations, which is one less thing the Scheduler needs to check on every iteration. Also, add a BlockTimeout class that will automatically handle relative or absolute timeouts as well as overriding timeouts (e.g. socket timeouts) more consistently. Also, rework the TimerQueue class to be able to fire events from any processor, which requires Timer to be RefCounted. Also allow creating id-less timers for use by blocking operations.
This commit is contained in:
parent
e0e26c6c67
commit
6cb640eeba
19 changed files with 461 additions and 263 deletions
|
@ -31,6 +31,7 @@
|
|||
#include <AK/IntrusiveList.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/SpinLock.h>
|
||||
#include <Kernel/Time/TimeManagement.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
@ -44,9 +45,7 @@ struct SchedulerData;
|
|||
extern Thread* g_finalizer;
|
||||
extern WaitQueue* g_finalizer_wait_queue;
|
||||
extern Atomic<bool> g_finalizer_has_work;
|
||||
extern u64 g_uptime;
|
||||
extern SchedulerData* g_scheduler_data;
|
||||
extern timeval g_timeofday;
|
||||
extern RecursiveSpinLock g_scheduler_lock;
|
||||
|
||||
class Scheduler {
|
||||
|
@ -57,7 +56,6 @@ public:
|
|||
static void timer_tick(const RegisterState&);
|
||||
[[noreturn]] static void start();
|
||||
static bool pick_next();
|
||||
static timeval time_since_boot();
|
||||
static bool yield();
|
||||
static bool donate_to_and_switch(Thread*, const char* reason);
|
||||
static bool donate_to(RefPtr<Thread>&, const char* reason);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue