KallistiOS  2.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Public Member Functions | Data Fields
kthread Struct Reference

Structure describing one running thread. More...

#include <kos/thread.h>

Public Member Functions

 LIST_ENTRY (kthread) t_list
 Thread list handle. Not a function.
 TAILQ_ENTRY (kthread) thdq
 Run/Wait queue handle. Once again, not a function.
 TAILQ_ENTRY (kthread) timerq
 Timer queue handle (if applicable). Also not a function.

Data Fields

tid_t tid
 Kernel thread id.
prio_t prio
 Static priority: 0..PRIO_MAX (higher means lower priority).
uint32 flags
 Thread flags.
int state
 Process state.
void * wait_obj
 Generic wait target, if waiting.
const char * wait_msg
 Generic wait message, if waiting.
void(* wait_callback )(void *obj)
 Wait timeout callback.
uint64 wait_timeout
 Next scheduled time. This value is used for sleep and timed block operations. This value is in milliseconds since the start of timer_ms_gettime(). This should be enough for something like 2 million years of wait time. ;)
char label [256]
 Thread label. This value is used when printing out a user-readable process listing.
char pwd [256]
 Current file system path.
irq_context_t context
 Register store – used to save thread context.
uint32stack
 Thread private stack. This should be a pointer to the base of a stack page.
uint32 stack_size
 Size of the thread's stack, in bytes.
int thd_errno
 Thread errno variable.
struct _reent thd_reent
 Our reent struct for newlib.
struct kthread_tls_kv_list tls_list
 Thread-local storage.
void * rv
 Return value of the thread function. This is only used in joinable threads.

Detailed Description

Structure describing one running thread.

Each thread has one of this structure assigned to it, which hold all the data associated with the thread. There are various functions to manipulate the data in here, so you shouldn't generally do so manually.


Member Function Documentation

kthread::LIST_ENTRY ( kthread  )

Thread list handle. Not a function.

kthread::TAILQ_ENTRY ( kthread  )

Run/Wait queue handle. Once again, not a function.

kthread::TAILQ_ENTRY ( kthread  )

Timer queue handle (if applicable). Also not a function.


Field Documentation

irq_context_t kthread::context

Register store – used to save thread context.

uint32 kthread::flags

Thread flags.

See also:
Thread flag values
char kthread::label[256]

Thread label. This value is used when printing out a user-readable process listing.

prio_t kthread::prio

Static priority: 0..PRIO_MAX (higher means lower priority).

char kthread::pwd[256]

Current file system path.

void* kthread::rv

Return value of the thread function. This is only used in joinable threads.

uint32* kthread::stack

Thread private stack. This should be a pointer to the base of a stack page.

uint32 kthread::stack_size

Size of the thread's stack, in bytes.

int kthread::state

Process state.

See also:
Thread states
int kthread::thd_errno

Thread errno variable.

struct _reent kthread::thd_reent

Our reent struct for newlib.

tid_t kthread::tid

Kernel thread id.

struct kthread_tls_kv_list kthread::tls_list

Thread-local storage.

See also:
kos/tls.h
void(* kthread::wait_callback)(void *obj)

Wait timeout callback.

If the genwait times out while waiting, this function will be called. This allows hooks for things like fixing up semaphore count values, etc.

Parameters:
objThe object that we were waiting on.
const char* kthread::wait_msg

Generic wait message, if waiting.

See also:
kos/genwait.h
void* kthread::wait_obj

Generic wait target, if waiting.

See also:
kos/genwait.h
uint64 kthread::wait_timeout

Next scheduled time. This value is used for sleep and timed block operations. This value is in milliseconds since the start of timer_ms_gettime(). This should be enough for something like 2 million years of wait time. ;)


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