cyg_thread_get_priority, cyg_thread_get_current_priority, cyg_thread_set_priority — Examine and manipulate thread priorities
|cyg_handle_t thread ,|
Typical schedulers use the concept of a thread priority to determine
which thread should run next. Exactly what this priority consists of
will depend on the scheduler, but a typical implementation would be a
small integer in the range 0 to 31, with 0 being the highest priority.
Usually only the idle thread will run at the lowest priority. The
exact number of priority levels available depends on the
configuration, typically the option
cyg_thread_get_priority can be used to determine
the priority of a thread, or more correctly the value last used in a
cyg_thread_set_priority call or when the thread
was first created. In some circumstances it is possible that the
thread is actually running at a higher priority. For example, if it
owns a mutex and priority ceilings or inheritance is being used to
prevent priority inversion problems, then the thread's priority may
have been boosted temporarily.
cyg_thread_get_current_priority returns the real
In many applications appropriate thread priorities can be determined
and allocated statically. However, if it is necessary for a thread's
priority to change at run-time then the
cyg_thread_set_priority function provides this
cyg_thread_get_current_priority can be called
from thread or DSR context, although the latter is rarely useful.
cyg_thread_set_priority should also only be
called from thread context.
|2023-01-12||Open Publication License|