diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-24 14:54:22 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-24 14:54:22 -0400 |
| commit | ed8b8901c067f0d378f973622f5f6d560d21e914 (patch) | |
| tree | 5386490c8accd338836fc8764181ea2bb3f8df1f /stdlib/threads.c | |
| parent | 800e386105255c9c4faa9a7051b100a8768a70de (diff) | |
Add '$' prefix on all user code
Diffstat (limited to 'stdlib/threads.c')
| -rw-r--r-- | stdlib/threads.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/stdlib/threads.c b/stdlib/threads.c index 74e73832..59e98dd7 100644 --- a/stdlib/threads.c +++ b/stdlib/threads.c @@ -12,32 +12,33 @@ #include "arrays.h" #include "text.h" +#include "threads.h" #include "types.h" #include "util.h" -public pthread_t *Thread$new(Closure_t fn) +public Thread_t Thread$new(Closure_t fn) { - pthread_t *thread = new(pthread_t); + Thread_t thread = new(pthread_t); pthread_create(thread, NULL, fn.fn, fn.userdata); return thread; } -public void Thread$join(pthread_t *thread) +public void Thread$join(Thread_t thread) { pthread_join(*thread, NULL); } -public void Thread$cancel(pthread_t *thread) +public void Thread$cancel(Thread_t thread) { pthread_cancel(*thread); } -public void Thread$detach(pthread_t *thread) +public void Thread$detach(Thread_t thread) { pthread_detach(*thread); } -Text_t Thread$as_text(const pthread_t **thread, bool colorize, const TypeInfo *type) +Text_t Thread$as_text(const Thread_t *thread, bool colorize, const TypeInfo *type) { (void)type; if (!thread) { @@ -46,8 +47,8 @@ Text_t Thread$as_text(const pthread_t **thread, bool colorize, const TypeInfo *t return Text$format(colorize ? "\x1b[34;1mThread(%p)\x1b[m" : "Thread(%p)", *thread); } -public const TypeInfo Thread = { - .size=sizeof(pthread_t*), .align=__alignof(pthread_t*), +public const TypeInfo Thread$info = { + .size=sizeof(Thread_t), .align=__alignof(Thread_t), .tag=CustomInfo, .CustomInfo={.as_text=(void*)Thread$as_text}, }; |
