sched: add task and thread alloc functions

This commit is contained in:
2023-03-09 19:55:52 +00:00
parent f2b929e52e
commit 3e954b1e13
4 changed files with 161 additions and 19 deletions

29
sched/thread.c Normal file
View File

@@ -0,0 +1,29 @@
#include <socks/sched.h>
#include <socks/object.h>
static object_type_t thread_type = {
.ob_name = "thread",
.ob_size = sizeof(thread_t),
};
kern_status_t thread_object_type_init(void)
{
return object_type_register(&thread_type);
}
thread_t *thread_alloc(void)
{
object_t *thread_obj = object_create(&thread_type);
if (!thread_obj) {
return NULL;
}
thread_t *t = object_data(thread_obj);
memset(t, 0x00, sizeof *t);
return t;
}
void thread_free(thread_t *thr)
{
}