zyfeier commented on code in PR #6987: URL: https://github.com/apache/incubator-nuttx/pull/6987#discussion_r963716384
########## sched/semaphore/sem_post.c: ########## @@ -139,38 +139,32 @@ int nxsem_post(FAR sem_t *sem) * that we want. */ +#ifndef CONFIG_TASK_LIST_OPTIMIZE for (stcb = (FAR struct tcb_s *)g_waitingforsemaphore.head; (stcb && stcb->waitsem != sem); stcb = stcb->flink); +#else + /* When enable task list optimize, remove TCB in semaphore waiting + * list before set waitsem to null. + */ - if (stcb != NULL) - { - /* The task will be the new holder of the semaphore when - * it is awakened. - */ - - nxsem_add_holder_tcb(stcb, sem); + stcb = (FAR struct tcb_s *)dq_remfirst(SEM_WAIT_TLIST(sem)); +#endif + DEBUGASSERT(stcb != NULL); - /* Stop the watchdog timer */ + nxsem_add_holder_tcb(stcb, sem); - wd_cancel(&stcb->waitdog); + /* Stop the watchdog timer */ - /* It is, let the task take the semaphore */ + wd_cancel(&stcb->waitdog); - stcb->waitsem = NULL; + /* It is, let the task take the semaphore */ - /* Restart the waiting task. */ + stcb->waitsem = NULL; - up_unblock_task(stcb); - } -#if 0 /* REVISIT: This can fire on IOB throttle semaphore */ - else - { - /* This should not happen. */ + /* Restart the waiting task. */ - DEBUGPANIC(); - } -#endif Review Comment: Yes, this is not a modification for this feature, i'll change back. -- 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