MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / Handler

Function Handler

Kernel/src/arch/x86_64/timer.cpp:123–143  ·  view source on GitHub ↗

Timer handler

Source from the content-addressed store, hash-verified

121
122 // Timer handler
123 void Handler(void*, regs64_t *r) {
124 ticks++;
125 if(ticks >= frequency){
126 uptime++;
127 ticks -= frequency;
128 }
129
130 if(sleeping.get_length() && !(acquireTestLock(&sleepQueueLock))){
131 if(sleeping.get_length()){ // Make sure the queue has not changed inbetween checking the length and acquiring the lock
132 sleeping.get_front().ticksLeft--;
133
134 while(sleeping.get_length() && sleeping.get_front().ticksLeft <= 0){
135 Scheduler::UnblockThread(sleeping.remove_at(0).thread);
136 }
137 }
138
139 releaseLock(&sleepQueueLock);
140 }
141
142 Scheduler::Tick(r);
143 }
144
145 // Initialize
146 void Initialize(uint32_t freq) {

Callers

nothing calls this directly

Calls 5

UnblockThreadFunction · 0.85
TickFunction · 0.85
get_frontMethod · 0.80
get_lengthMethod · 0.45
remove_atMethod · 0.45

Tested by

no test coverage detected