mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
cpu/esp_common: fix of blocking mechanism in FreeRTOS queus
When FreeRTOS semaphores, as required by ESP-IDF, are used together with `gnrc_netif`, RIOT may crash if `STATUS_RECEIVE_BLOCKED` is used as a blocking mechanism in the FreeRTOS adaptation layer. The reason for this is that `gnrc_netif` uses thread flags since PR #16748. If the `gnrc_netif` thread is blocked because of a FreeRTOS semaphore, and is thus in `STATUS_RECEIVE_BLOCKED` state, the `_msg_send` function will cause a crash because it then assumes that `target->wait_data` contains a pointer to a message of type `msg_t`, but by using thread flags it contains the flag mask. This situation can happen if the ESP hardware is used while another thread is sending something timer controlled to the `gnrc_netif` thread. To solve this problem `STATUS_MUTEX_LOCKED` is used instead of `STATUS_RECEIVE_BLOCKED` and `STATUS_SEND_BLOCKED`
This commit is contained in:
parent
4bcaab1eb7
commit
35676ca712
@ -280,7 +280,7 @@ BaseType_t IRAM_ATTR _queue_generic_send(QueueHandle_t xQueue,
|
||||
else {
|
||||
/* suspend the calling thread to wait for space in the queue */
|
||||
thread_t *me = thread_get_active();
|
||||
sched_set_status(me, STATUS_SEND_BLOCKED);
|
||||
sched_set_status(me, STATUS_MUTEX_BLOCKED);
|
||||
/* waiting list is sorted by priority */
|
||||
thread_add_to_list(&queue->sending, me);
|
||||
|
||||
@ -408,7 +408,7 @@ BaseType_t IRAM_ATTR _queue_generic_recv (QueueHandle_t xQueue,
|
||||
else {
|
||||
/* suspend the calling thread to wait for an item in the queue */
|
||||
thread_t *me = thread_get_active();
|
||||
sched_set_status(me, STATUS_RECEIVE_BLOCKED);
|
||||
sched_set_status(me, STATUS_MUTEX_BLOCKED);
|
||||
/* waiting list is sorted by priority */
|
||||
thread_add_to_list(&queue->receiving, me);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user