Timer handler
| 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) { |
nothing calls this directly
no test coverage detected