PatchworkOS  966e257
A non-POSIX operating system.
Loading...
Searching...
No Matches
thrd_create.c
Go to the documentation of this file.
1#include <stdatomic.h>
2#include <stdbool.h>
3#include <stdio.h>
4#include <stdlib.h>
5#include <sys/proc.h>
6#include <threads.h>
7
10
11int thrd_create(thrd_t* thr, thrd_start_t func, void* arg)
12{
13 _thread_t* thread = _thread_new(func, arg);
14 if (thread == NULL)
15 {
16 return thrd_error;
17 }
18
19 thr->id = thread->id;
20 return thrd_success;
21}
#define NULL
Pointer error value.
Definition NULL.h:23
_thread_t * _thread_new(thrd_start_t func, void *arg)
Definition thread.c:85
tid_t id
Definition thread.h:25
tid_t id
Definition threads.h:39
int thrd_create(thrd_t *thr, thrd_start_t func, void *arg)
Definition thrd_create.c:11
int(* thrd_start_t)(void *)
Definition threads.h:60
@ thrd_success
Definition threads.h:74
@ thrd_error
Definition threads.h:76