diff --git a/sys/bootstrap/CMakeLists.txt b/sys/bootstrap/CMakeLists.txt index cd52200..072fb9a 100644 --- a/sys/bootstrap/CMakeLists.txt +++ b/sys/bootstrap/CMakeLists.txt @@ -6,7 +6,7 @@ set_property(SOURCE ${arch_sources} PROPERTY LANGUAGE C) add_executable(bootstrap ${c_sources} ${arch_sources}) target_link_libraries(bootstrap - libmango libc-core libc-malloc libfs-static liblaunch libxpc-static + libmango libc-core libc-malloc libc-pthread libfs-static liblaunch libxpc-static interface::fs) target_compile_options(bootstrap PRIVATE diff --git a/sys/bootstrap/main.c b/sys/bootstrap/main.c index fa3ef1a..6355f81 100644 --- a/sys/bootstrap/main.c +++ b/sys/bootstrap/main.c @@ -7,10 +7,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -90,6 +92,13 @@ static void _fs_free(struct fs_allocator *alloc, void *p) heap_free(alloc->fs_arg, p); } +void *thread_func(void *arg) +{ + kern_logf("a thread! (%p)", pthread_self()); + // kern_logf("a thread!"); + return (void *)0x123; +} + int main( int argc, const char **argv, @@ -159,6 +168,11 @@ int main( kern_handle_t channel; channel_create(0, &channel); + pthread_t thread; + pthread_create(&thread, NULL, thread_func, NULL); + pthread_detach(thread); + kern_logf("created new thread %p", thread); + launch_ctx_init(&launch); launch.ctx_resolve_library = resolve_dependency; @@ -169,6 +183,10 @@ int main( return -1; } + kern_handle_close(result.r_task); + kern_handle_close(result.r_thread); + kern_handle_close(result.r_address_space); + heap_t heap = HEAP_INIT; struct fs_allocator fs_allocator = {