This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/PROCESSOR-SDK-AM437X: Atomic use of Queue_get

Part Number: PROCESSOR-SDK-AM437X
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hi

I would like to use the SYS/BIOS Queue_get() function for taking out elements of my free queue. It has been a while (more than 2 years) since I last used the Queue functionality.

From here (software-dl.ti.com/.../Queue.html

I can see that Queue_get() works atomically, which is what I need. It seems though that if the queue is empty it will return non-NULL and the manual states to uses Queue_empty() to check if there are any elements in the queue. This is really bad design (well at least in my case). Now I will have to do my own protection of the queue to make sure that I atomically can take out elements of the queue and be sure that I do actually get a valid element.
E.g.
1. Protect access to queue

2. Check queue is not empty

3. Get element from queue

4. Unprotect access to queue

I believe in the earlier days (DSP/BIOS) you would get a pointer to your queue handle, if the queue is empty?

Does this still apply and if so can I use this safely (considering future revisions of SYS/BIOS)?

/Mads