File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -102,19 +102,22 @@ static void task_stack_check(void)
102
102
}
103
103
}
104
104
105
- /* Delay update with early termination for active tasks */
105
+ /* Updates task delay counters and unblocks tasks when delays expire */
106
106
static list_node_t * delay_update (list_node_t * node , void * arg )
107
107
{
108
108
(void ) arg ;
109
109
if (unlikely (!node || !node -> data ))
110
110
return NULL ;
111
111
112
112
tcb_t * t = node -> data ;
113
- /* Only process blocked tasks with active delays */
114
- if (t -> state == TASK_BLOCKED && t -> delay > 0 ) {
115
- if (-- t -> delay == 0 )
116
- t -> state = TASK_READY ;
117
- }
113
+
114
+ /* Skip non-blocked tasks (common case) */
115
+ if (likely (t -> state != TASK_BLOCKED ))
116
+ return NULL ;
117
+
118
+ /* Decrement delay and unblock task if expired */
119
+ if (t -> delay > 0 && -- t -> delay == 0 )
120
+ t -> state = TASK_READY ;
118
121
return NULL ;
119
122
}
120
123
You can’t perform that action at this time.
0 commit comments