Kernel/LibC: Add basic support for pthread_{create,exit}

This commit is contained in:
2025-04-01 23:08:27 +03:00
parent 788f5429e1
commit c1618e2b5d
9 changed files with 178 additions and 10 deletions

View File

@@ -0,0 +1,8 @@
set(SOURCES
main.cpp
)
add_executable(test-pthread ${SOURCES})
banan_link_library(test-pthread libc)
install(TARGETS test-pthread OPTIONAL)

View File

@@ -0,0 +1,28 @@
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
void* thread_func(void*)
{
printf("hello from thread\n");
return nullptr;
}
int main(int argc, char** argv)
{
pthread_t tid;
printf("creating thread\n");
if (pthread_create(&tid, nullptr, &thread_func, nullptr) == -1)
{
perror("pthread_create");
return 1;
}
sleep(1);
printf("exiting\n");
return 0;
}