This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 6ae0eae83fc9cc7f602c1a4d77b86a55a4b03042 Author: fangyibo <[email protected]> AuthorDate: Thu Nov 12 14:46:48 2026 +0800 audio_fake: skip the stop message when the worker already exited The worker can exit on its own, for example when a processing error sets terminate, and it closes its message queue on the way out. A following stop() then sent into the closed queue and crashed in nxmq_verify_send(). Probe worker liveness through the exit semaphore first and reap the thread without sending when it is already gone. Signed-off-by: fangyibo <[email protected]> --- drivers/audio/audio_fake.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/audio/audio_fake.c b/drivers/audio/audio_fake.c index 4a0d14f72a4..9817dbad1c7 100644 --- a/drivers/audio/audio_fake.c +++ b/drivers/audio/audio_fake.c @@ -882,6 +882,18 @@ static int audio_fake_stop(FAR struct audio_lowerhalf_s *dev) FAR void *value; int ret; + if (nxsem_trywait(&priv->exitsem) == 0) + { + nxsem_post(&priv->exitsem); + if (priv->threadid != 0) + { + pthread_join(priv->threadid, &value); + priv->threadid = 0; + } + + return OK; + } + /* Send a message to stop all audio streaming */ term_msg.msg_id = AUDIO_MSG_STOP;
