Fix-Point commented on code in PR #16231: URL: https://github.com/apache/nuttx/pull/16231#discussion_r2057799243
########## sched/wqueue/kwork_thread.c: ########## @@ -216,17 +278,54 @@ static int work_thread(int argc, FAR char *argv[]) * posted. */ - wqueue->wait_count++; + /* Check the waiting queue */ + + has_next = false; + + if (!list_is_empty(&wqueue->pending)) + { + work = list_first_entry(&wqueue->pending, struct work_s, node); + + /* The work thread will go sleep until work->qtime */ + + ticks = work->qtime; + has_next = true; + } + spin_unlock_irqrestore(&wqueue->lock, flags); sched_unlock(); + /* Set the earliest expired work delay */ + + if (has_next) + { + /* If the earliest work has already expired. */ + + if (clock_compare(ticks, clock_systime_ticks())) Review Comment: The semantic of `ticks` has changed if `has_next == true`. It represents the next expired time. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org