]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commitdiff
cleanup: remove stale comments from process_sleep and process_wake_check
authorTulio A M Mendes <[email protected]>
Fri, 13 Feb 2026 19:24:05 +0000 (16:24 -0300)
committerTulio A M Mendes <[email protected]>
Fri, 13 Feb 2026 19:24:05 +0000 (16:24 -0300)
src/kernel/scheduler.c

index eb98954b2f9d6693ec826b7077d5a029e1816246..a36d07a50ea03576ecebbc9a6c86fa9dd6616dce 100644 (file)
@@ -868,42 +868,26 @@ void schedule(void) {
 }
 
 void process_sleep(uint32_t ticks) {
-    // We need current tick count. 
-    // For simplicity, let's just use a extern or pass it.
-    // But usually sleep() is called by process logic.
-    // Let's assume we read the global tick from timer.h accessor (TODO)
-    // Or we just add 'ticks' to current.
-    
-    // Quick fix: declare extern tick from timer.c
     extern uint32_t get_tick_count(void);
-    
     uint32_t current_tick = get_tick_count();
 
     uintptr_t flags = spin_lock_irqsave(&sched_lock);
     current_process->wake_at_tick = current_tick + ticks;
     current_process->state = PROCESS_SLEEPING;
-    
     spin_unlock_irqrestore(&sched_lock, flags);
 
-    // Force switch immediately. Since current state is SLEEPING, schedule() will pick someone else.
     schedule();
-
-    // When we return here, we woke up!
 }
 
 void process_wake_check(uint32_t current_tick) {
-    // Called by Timer ISR
     uintptr_t flags = spin_lock_irqsave(&sched_lock);
     struct process* iter = ready_queue_head;
-    
-    // Iterate all processes (Circular list)
-    // Warning: O(N) inside ISR. Not ideal for 1000 processes.
-    
+
     if (!iter) {
         spin_unlock_irqrestore(&sched_lock, flags);
         return;
     }
-    
+
     /* CPU time accounting: charge one tick to the running process */
     if (current_process && current_process->state == PROCESS_RUNNING) {
         current_process->utime++;