diff --git a/doc/kernel/services/data_passing/message_queues.rst b/doc/kernel/services/data_passing/message_queues.rst index afa33310484..18c8cf34eba 100644 --- a/doc/kernel/services/data_passing/message_queues.rst +++ b/doc/kernel/services/data_passing/message_queues.rst @@ -108,6 +108,7 @@ The following code builds on the example above, and uses the message queue to pass data items from a producing thread to one or more consuming threads. If the message queue fills up because the consumers can't keep up, the producing thread throws away all existing data so the newer data can be saved. +Note that this api will trigger reschedule. .. code-block:: c diff --git a/kernel/msg_q.c b/kernel/msg_q.c index 190b8c4e78e..9035fccda7d 100644 --- a/kernel/msg_q.c +++ b/kernel/msg_q.c @@ -178,7 +178,7 @@ int z_impl_k_msgq_put(struct k_msgq *msgq, const void *data, k_timeout_t timeout SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_msgq, put, msgq, timeout, result); - k_spin_unlock(&msgq->lock, key); + z_reschedule(&msgq->lock, key); return result; }