summaryrefslogtreecommitdiff
path: root/kc/core/task.h
blob: eae38bb40bdb6bf2b2ab26b1bc2b10d81feb8f71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once

#include <stdint.h>

enum kc_thread_status
{
	AVAILABLE,
	CREATED,
    READY,
    RUNNING,
    SLEEPING,
    BLOCKED,
    TERMINATED
};

union kc_thread_result
{
	uint64_t scalar;
	void *pointer;
};

struct kc_thread
{
	void *kernel_stack_head;
	void *kernel_stack_pointer;
	uint64_t time_elapsed;
	union kc_thread_result result;
	enum kc_thread_status status;
	struct kc_thread *next;
	uint64_t sleep_expiration;
};

void task_init(void);

void kct_terminate(union kc_thread_result result);