Muteki
EABI code execution on Besta® RTOS devices.
Loading...
Searching...
No Matches
bxc_thread_s Struct Reference

Thread descriptor structure. More...

#include <threading.h>

Data Structures

union  [union].__unnamed0__

Data Fields

int magic
 Magic. Always 0x100.
uintptr_t * sp
 Stack pointer.
void * stack
 Allocated stack memory.
int exit_code
 Exit code of the thread. Initializes to 0.
bxc_errno_t kerrno
 Error code.
uintptr_t unk_0x14
 Unknown. Initializes to 0x80000000.
bxc_thread_func_t thread_func
 Thread function entrypoint.
short timeout
 Thread execution timeout in number of scheduler ticks.
short sleep_counter
 Number of scheduler time units left to sleep.
short wait_reason
 Current wait reason of the thread.
short slot
 Slot number. For scheduler.
char slot_low3b
 Lower 3 bit of the slot number. For scheduler.
char slot_high3b
 Upper 3 bit of the slot number. For scheduler.
unsigned char slot_low3b_bit
 Lower 3 bit bitmask of the slot number. For scheduler.
unsigned char slot_high3b_bit
 Upper 3 bit bitmask of the slot number. For scheduler.
bxc_waitable_desc_t * event
 Waitable descriptor (excluding critical sections) that the thread is waiting for.
bxc_thread_t * prev
 Previous thread descriptor.
bxc_thread_t * next
 Next thread descriptor.
union  

Detailed Description

Thread descriptor structure.

Field Documentation

◆ magic

int bxc_thread_s::magic

Magic. Always 0x100.

See also
bxc_threading_kind_e

◆ sleep_counter

short bxc_thread_s::sleep_counter

Number of scheduler time units left to sleep.

This value is populated by OSSleep() when the time_units parameter is bigger than 0.

◆ sp

uintptr_t* bxc_thread_s::sp

Stack pointer.

When the thread is suspended this will point to the CPU context saved on thread stack.

◆ timeout

short bxc_thread_s::timeout

Thread execution timeout in number of scheduler ticks.

This value is initialized by the scheduler with a value that is inverse proportional to the slot number, meaning higher priority threads have longer timeouts. This value ticks down every scheduler tick that the thread is not spent sleeping. When the timeout reaches 0, the thread is "timed out" and gets put into sleep (adding BXC_WAIT_ON_SLEEP to bxc_thread_t::wait_reason) with the bxc_thread_t::sleep_counter value set to 0 (meaning that the thread is yielded, and lower priority thread will be executed next). In cases of a thread wake or when scheduler enters idle condition, this value may also be reset.

◆ wait_reason

short bxc_thread_s::wait_reason

Current wait reason of the thread.

See also
bxc_wait_reason_e

The documentation for this struct was generated from the following file: