Skip to content

Commit fc47180

Browse files
TaiJuWukartben
authored andcommitted
kernel: k_msgq_put should trigger reschedule
Make `k_msgq_put` as scheduler point to resolve high priority thread can not preempt low priority thread. Signed-off-by: TaiJu Wu <[email protected]>
1 parent 42511c8 commit fc47180

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

doc/kernel/services/data_passing/message_queues.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ The following code builds on the example above, and uses the message queue
108108
to pass data items from a producing thread to one or more consuming threads.
109109
If the message queue fills up because the consumers can't keep up, the
110110
producing thread throws away all existing data so the newer data can be saved.
111+
Note that this api will trigger reschedule.
111112

112113
.. code-block:: c
113114

kernel/msg_q.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ int z_impl_k_msgq_put(struct k_msgq *msgq, const void *data, k_timeout_t timeout
178178

179179
SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_msgq, put, msgq, timeout, result);
180180

181-
k_spin_unlock(&msgq->lock, key);
181+
z_reschedule(&msgq->lock, key);
182182

183183
return result;
184184
}

0 commit comments

Comments
 (0)