This commit is contained in:
2025-11-25 23:14:26 +01:00
parent 0c81973aa2
commit cbedadd36e
3 changed files with 24 additions and 0 deletions

View File

@@ -7,6 +7,7 @@
#include "sys/stat.h"
#include "unistd.h" // POSIX Standard
#include "stdio.h"
#include "pthread.h"
void *os_alloc(size_t capacity) {
return mmap(0, capacity, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
@@ -96,4 +97,13 @@ void os_print(StdStream target, const char *fmt, va_list argList) {
scratchEnd(temp);
}
OS_Thread os_createThread(void *(*entry)(void *), void *ctx) {
pthread_t handle;
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_create(&handle, &attr, entry, ctx);
pthread_attr_destroy(&attr);
return (OS_Thread){ .id=handle };
}
#endif