bootstrap: test pthread features
This commit is contained in:
@@ -7,10 +7,12 @@
|
||||
#include <fs/context.h>
|
||||
#include <heap/heap.h>
|
||||
#include <launch.h>
|
||||
#include <mango/handle.h>
|
||||
#include <mango/log.h>
|
||||
#include <mango/msg.h>
|
||||
#include <mango/task.h>
|
||||
#include <mango/types.h>
|
||||
#include <pthread.h>
|
||||
#include <rosetta/bootstrap.h>
|
||||
#include <rosetta/fs.h>
|
||||
#include <stdint.h>
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user