do we need mutexes while using queues?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ritu_2178811
Level 3
Level 3
5 likes given First like received First like given

Hello,

Queues are meant to send data between threads so I guess there is already a synchronization mechanisim inside but since I didn't see it in the documentation. I wanted to ask.

do queues in wiced sdk have internal synchronization mechanism? or should we use a mutex

thanks

0 Likes
1 Solution
Anonymous
Not applicable

I found a queston about ThreadX at here : multithreading - access a threadx-queue concurrently - Stack Overflow

This maybe a fundemental for embedded programming, but I thing it should written at docs (not shown at 5.0.1 doc).

Another question, how can I find which backend I am using (ThreadX, RTOS, etc) ?

View solution in original post

2 Replies
Anonymous
Not applicable

I found a queston about ThreadX at here : multithreading - access a threadx-queue concurrently - Stack Overflow

This maybe a fundemental for embedded programming, but I thing it should written at docs (not shown at 5.0.1 doc).

Another question, how can I find which backend I am using (ThreadX, RTOS, etc) ?

AxLi_1746341
Level 7
Level 7
10 comments on KBA 5 comments on KBA First comment on KBA

riforifo wrote:

Hello,

Queues are meant to send data between threads so I guess there is already a synchronization mechanisim inside but since I didn't see it in the documentation. I wanted to ask.

do queues in wiced sdk have internal synchronization mechanism? or should we use a mutex

thanks

Both ThreadX and FreeRTOS provide thread safe APIs to access the queue.

However, the WICED API level is racy for ThreadX build because it directly

dereferences the data structure in the RTOS.

e.g. wiced_rtos_get_queue_occupancy/wiced_rtos_is_queue_empty/wiced_rtos_is_queue_full

Add locking does not help, because the RTOS does not hold the lock adding by WICED API layer while accessing the data structure.

It's simply buggy.

0 Likes