kernel/queue: Fix SMP race
Calling z_ready_thread() means the thread is now ready and can wake up at any moment on another CPU. But we weren't finished setting the return value! So the other side could wake up with a spurious "error" condition if it ran too soon. Note that on systems with a working IPI, that wakeup can happen much faster than you might think. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
parent
3235451880
commit
4c2fc2aed7
1 changed files with 1 additions and 1 deletions
|
@ -103,8 +103,8 @@ static inline void z_vrfy_k_queue_init(struct k_queue *queue)
|
|||
#if !defined(CONFIG_POLL)
|
||||
static void prepare_thread_to_run(struct k_thread *thread, void *data)
|
||||
{
|
||||
z_ready_thread(thread);
|
||||
z_thread_return_value_set_with_data(thread, 0, data);
|
||||
z_ready_thread(thread);
|
||||
}
|
||||
#endif /* CONFIG_POLL */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue