CMSIS-RTOS osThreadYield does not pass control

Hi

I am trying to use the osThreadYield function of the CMSIS-RTOS and even though I have many other threads in the READY state, control is not passed to them and I stay in the current thread which basically hangs the entire system.

This thread is the highest priority thread which is polling a CAN bus interface for messages but I want it to give up control to allow other tasks if they need to run.

I suspect that there is a statement missing from the description below that as task will give up control to HIGHER prioirty threads that are READY. Not just any thread as they imply below.

Does anyone know if this is the case? Or why this highest priority thread will not give up control when asked to?

Thanks
Steve

osStatus osThreadYield ( void )

Returns status code that indicates the execution status of the function.

Note MUST REMAIN UNCHANGED: osThreadYield shall be consistent in every CMSIS-RTOS.

Pass control to the next thread that is in state READY. If there is no other thread in the state READY, the current thread continues execution and no thread switching occurs.

Parents
  • Note that yield will not drop the thread priority.

    So the OS will only look for other threads of same priority that is ready. Yield is intended for round-robin execution of multiple same-priority threads.

    A high-priority thread that have nothing to do should sleep - either a fixed amount of time, or waiting for some event, mail or similar. Then it will be able to take advantage of that higher priority to get first in line when it finally gets something to do.

Reply
  • Note that yield will not drop the thread priority.

    So the OS will only look for other threads of same priority that is ready. Yield is intended for round-robin execution of multiple same-priority threads.

    A high-priority thread that have nothing to do should sleep - either a fixed amount of time, or waiting for some event, mail or similar. Then it will be able to take advantage of that higher priority to get first in line when it finally gets something to do.

Children
More questions in this forum