PatchworkOS
966e257
A non-POSIX operating system.
Theme:
Default
Round
Robot
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
8
#include "
user/common/syscalls.h
"
9
#include "
user/common/thread.h
"
10
11
int
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
}
NULL
#define NULL
Pointer error value.
Definition
NULL.h:23
_thread_new
_thread_t * _thread_new(thrd_start_t func, void *arg)
Definition
thread.c:85
proc.h
thread.h
stdatomic.h
stdbool.h
stdio.h
stdlib.h
_thread_t
Definition
thread.h:23
_thread_t::id
tid_t id
Definition
thread.h:25
thrd_t
Definition
threads.h:38
thrd_t::id
tid_t id
Definition
threads.h:39
syscalls.h
thrd_create
int thrd_create(thrd_t *thr, thrd_start_t func, void *arg)
Definition
thrd_create.c:11
threads.h
thrd_start_t
int(* thrd_start_t)(void *)
Definition
threads.h:60
thrd_success
@ thrd_success
Definition
threads.h:74
thrd_error
@ thrd_error
Definition
threads.h:76
src
libstd
user
functions
thread
thrd_create.c
Generated on Mon Dec 15 2025 21:55:53 for PatchworkOS by
1.9.8