patacongo commented on code in PR #9404: URL: https://github.com/apache/nuttx/pull/9404#discussion_r1209413307
########## arch/xtensa/src/common/xtensa_nputs.c: ########## @@ -39,8 +40,14 @@ void up_nputs(const char *str, size_t len) Review Comment: > So either (1) up_nputs() must not use semaphores or (2) up_nputs() must not be used prior to calling nxsem_initialize(). There is a global variable g_nx_init_state that can also be used to check where nx_start is in the initialization sequence. I don't think that it is a issue here, but one other thing that we should all keep in mind: As a general rule, we should not use semaphores or mutexes on the IDLE thread. The IDLE thread is the thread that runs when you boot up the system. All initialization is performed on the IDLE thread, hence, it is sometimes called the initialization thread. Why not? Because of the result of calling sem_wait() were to cause the IDLE thread to attempt to wait, the system will crash. The IDLE thread can never wait and must always be in the ready-to-run state. This is not normally a problem during initialization because the system is running single-threaded during most of initialization and sem_wait() will never block while running single-threaded. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
