KallistiOS  ##version##
 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. More...
 
 TAILQ_ENTRY (kthread) thdq
 Run/Wait queue handle. Once again, not a function. More...
 
 TAILQ_ENTRY (kthread) timerq
 Timer queue handle (if applicable). Also not a function. More...
 

Data Fields

tid_t tid
 Kernel thread id. More...
 
prio_t prio
 Static priority: 0..PRIO_MAX (higher means lower priority). More...
 
uint32 flags
 Thread flags. More...
 
int state
 Process state. More...
 
void * wait_obj
 Generic wait target, if waiting. More...
 
const char * wait_msg
 Generic wait message, if waiting. More...
 
void(* wait_callback )(void *obj)
 Wait timeout callback. More...
 
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. ;) More...
 
char label [256]
 Thread label. This value is used when printing out a user-readable process listing. More...
 
char pwd [256]
 Current file system path. More...
 
irq_context_t context
 Register store – used to save thread context. More...
 
uint32stack
 Thread private stack. This should be a pointer to the base of a stack page. More...
 
uint32 stack_size
 Size of the thread's stack, in bytes. More...
 
int thd_errno
 Thread errno variable. More...
 
struct _reent thd_reent
 Our reent struct for newlib. More...
 
struct kthread_tls_kv_list tls_list
 Thread-local storage. More...
 
void * rv
 Return value of the thread function. This is only used in joinable threads. More...
 

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: