eCosTM Reference Manual
Prev | Chapter 5. Native kernel C language API | Next

# Priority manipulation

`void cyg_thread_set_priority`(cyg_handle_t thread, cyg_priority_t priority);

Sets the priority of the given thread to the given value. The smaller the value, the higher the priority of the thread.

Allowed priorities range between 1 and 64. The values of these parameters are configuration-dependent because they depend on which scheduler has been selected, and what value has been configured for the `CYGNUM_KERNEL_SCHED_PRIORITIES` configuration parameter (see the section called Thread operations and the section called Option: Number of priority levels in Chapter 17).

There is always an idle thread, owned by the kernel, running at `CYG_THREAD_MIN_PRIORITY`. Because of this, ordinary threads should never be run at the lowest priority.

`cyg_priority_t cyg_thread_get_priority`(cyg_handle_t thread);

Returns the priority of the given thread.

`void cyg_thread_delay`(cyg_tick_count_t delay);

Puts the current thread to sleep for `delay` ticks. In a default configuration there are approximately 100 ticks a second. The actual length of the ticks is given by the resolution of the real-time clock. See the section called Counters, clocks and alarms for more information on counter resolution.

Prev | Home | Next
Thread operations | Up | Exception handling