|
9 | 9 | #ifndef LLVM_LIBC_MACROS_PTHREAD_MACRO_H
|
10 | 10 | #define LLVM_LIBC_MACROS_PTHREAD_MACRO_H
|
11 | 11 |
|
| 12 | +#include "include/llvm-libc-macros/null-macro.h" |
| 13 | + |
12 | 14 | #define PTHREAD_CREATE_JOINABLE 0
|
13 | 15 | #define PTHREAD_CREATE_DETACHED 1
|
14 | 16 |
|
|
25 | 27 | #define PTHREAD_PROCESS_PRIVATE 0
|
26 | 28 | #define PTHREAD_PROCESS_SHARED 1
|
27 | 29 |
|
28 |
| -#define PTHREAD_MUTEX_INITIALIZER {} |
29 |
| -#define PTHREAD_RWLOCK_INITIALIZER {} |
| 30 | +#ifdef __linux__ |
| 31 | +#define PTHREAD_MUTEX_INITIALIZER \ |
| 32 | + { \ |
| 33 | + /* .__timed = */ 0, \ |
| 34 | + /* .__recursive = */ 0, \ |
| 35 | + /* .__robust = */ 0, \ |
| 36 | + /* .__owner = */ NULL, \ |
| 37 | + /* .__lock_count = */ 0, \ |
| 38 | + /* .__futex_word = */ \ |
| 39 | + { \ |
| 40 | + /* .__word = */ 0, \ |
| 41 | + }, \ |
| 42 | + } |
| 43 | +#else |
| 44 | +#define PTHREAD_MUTEX_INITIALIZER \ |
| 45 | + { \ |
| 46 | + /* .__timed = */ 0, /* .__recursive = */ 0, \ |
| 47 | + /* .__robust = */ 0, /* .__owner = */ NULL, \ |
| 48 | + /* .__lock_count = */ 0, \ |
| 49 | + } |
| 50 | +#endif |
| 51 | + |
| 52 | +#define PTHREAD_RWLOCK_INITIALIZER \ |
| 53 | + { \ |
| 54 | + /* .__is_pshared = */ 0, \ |
| 55 | + /* .__preference = */ 0, \ |
| 56 | + /* .__state = */ 0, \ |
| 57 | + /* .__write_tid = */ 0, \ |
| 58 | + /* .__wait_queue_mutex = */ \ |
| 59 | + { \ |
| 60 | + /* .__word = */ 0, \ |
| 61 | + }, \ |
| 62 | + /* .__pending_readers = */ \ |
| 63 | + { \ |
| 64 | + /* .__word = */ 0, \ |
| 65 | + }, \ |
| 66 | + /* .__pending_writers = */ \ |
| 67 | + { \ |
| 68 | + /* .__word = */ 0, \ |
| 69 | + }, \ |
| 70 | + /* .__reader_serialization = */ \ |
| 71 | + { \ |
| 72 | + /* .__word = */ 0, \ |
| 73 | + }, \ |
| 74 | + /* .__writer_serialization = */ \ |
| 75 | + { \ |
| 76 | + /* .__word = */ 0, \ |
| 77 | + }, \ |
| 78 | + } |
30 | 79 |
|
31 | 80 | // glibc extensions
|
32 | 81 | #define PTHREAD_STACK_MIN (1 << 14) // 16KB
|
|
0 commit comments