You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
747 B

#include "pthread.h"
_syscall2(int, create_thread, unsigned long, start, void*, arg);
_syscall2(int, syspthread_join, pthread_t, thread, void*, value_ptr);
_syscall1(int, endthread, int, value);
int pthread_attr_init(pthread_attr_t* attr)
{
;;;;;
return 0;
}
int pthread_create(pthread_t* thread, const pthread_attr_t* attr, void* (*start)(void*), void* arg)
{
int id = 0;
if (!thread) return EINVAL;
id = create_thread((unsigned long)start, (int*)arg);
if (id < 0) return errno;
*thread = id;
return id;
}
void pthread_exit(void* value_ptr)
{
endthread((int)value_ptr);
}
int pthread_join(pthread_t thread, void** value_ptr)
{
syspthread_join(thread, value_ptr);
return 0;
}