|
| 1 | +/** |
| 2 | + * D header file for Solaris thread.h. |
| 3 | + * |
| 4 | + * Copyright: Copyright © 2025, The D Language Foundation |
| 5 | + * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. |
| 6 | + * Authors: Iain Buclaw |
| 7 | + */ |
| 8 | +module core.sys.solaris.thread; |
| 9 | + |
| 10 | +version (Solaris): |
| 11 | +extern (C): |
| 12 | +nothrow: |
| 13 | +@nogc: |
| 14 | + |
| 15 | +import core.stdc.config : c_long; |
| 16 | +import core.sys.posix.signal : sigset_t, stack_t; |
| 17 | + |
| 18 | +/* |
| 19 | + * definitions needed to use the thread interface except synchronization. |
| 20 | + */ |
| 21 | +alias thread_t = int; |
| 22 | +alias thread_key_t = int; |
| 23 | + |
| 24 | +int thr_create(void*, size_t, void* function(void*), void*, c_long, thread_t*); |
| 25 | +int thr_join(thread_t, thread_t*, void**); |
| 26 | +int thr_setconcurrency(int); |
| 27 | +int thr_getconcurrency(); |
| 28 | +noreturn thr_exit(void*); |
| 29 | +thread_t thr_self(); |
| 30 | + |
| 31 | +int thr_sigsetmask(int, const scope sigset_t*, sigset_t*); |
| 32 | + |
| 33 | +int thr_stksegment(stack_t*); |
| 34 | + |
| 35 | +int thr_main(); |
| 36 | +int thr_kill(thread_t, int); |
| 37 | +int thr_suspend(thread_t); |
| 38 | +int thr_continue(thread_t); |
| 39 | +void thr_yield(); |
| 40 | +int thr_setprio(thread_t, int); |
| 41 | +int thr_getprio(thread_t, int*); |
| 42 | +int thr_keycreate(thread_key_t*, void function(void*)); |
| 43 | +int thr_keycreate_once(thread_key_t*, void function(void*)); |
| 44 | +int thr_setspecific(thread_key_t, void*); |
| 45 | +int thr_getspecific(thread_key_t, void**); |
| 46 | +size_t thr_min_stack(); |
| 47 | + |
| 48 | +alias THR_MIN_STACK = thr_min_stack; |
| 49 | + |
| 50 | +/* |
| 51 | + * thread flags (one word bit mask) |
| 52 | + */ |
| 53 | +enum : c_long |
| 54 | +{ |
| 55 | + THR_BOUND = 0x00000001, // = PTHREAD_SCOPE_SYSTEM |
| 56 | + THR_NEW_LWP = 0x00000002, |
| 57 | + THR_DETACHED = 0x00000040, // = PTHREAD_CREATE_DETACHED |
| 58 | + THR_SUSPENDED = 0x00000080, |
| 59 | + THR_DAEMON = 0x00000100, |
| 60 | +} |
| 61 | + |
| 62 | +/* |
| 63 | + * The key to be created by thr_keycreate_once() |
| 64 | + * must be statically initialized with THR_ONCE_KEY. |
| 65 | + */ |
| 66 | +enum thread_key_t THR_ONCE_KEY = -1; |
0 commit comments