1 //===-- Definition of pthread macros --------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLVM_LIBC_MACROS_PTHREAD_MACRO_H 10 #define LLVM_LIBC_MACROS_PTHREAD_MACRO_H 11 12 #include "null-macro.h" 13 14 #define PTHREAD_CREATE_JOINABLE 0 15 #define PTHREAD_CREATE_DETACHED 1 16 17 #define PTHREAD_MUTEX_NORMAL 0 18 #define PTHREAD_MUTEX_ERRORCHECK 1 19 #define PTHREAD_MUTEX_RECURSIVE 2 20 #define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL 21 22 #define PTHREAD_MUTEX_STALLED 0 23 #define PTHREAD_MUTEX_ROBUST 1 24 25 #define PTHREAD_ONCE_INIT {0} 26 27 #define PTHREAD_PROCESS_PRIVATE 0 28 #define PTHREAD_PROCESS_SHARED 1 29 30 #ifdef __linux__ 31 #define PTHREAD_MUTEX_INITIALIZER \ 32 { \ 33 /* .__timed = */ 0, /* .__recursive = */ 0, \ 34 /* .__robust = */ 0, /* .__owner = */ NULL, \ 35 /* .__lock_count = */ 0, /* .__futex_word = */ {0}, \ 36 } 37 #else 38 #define PTHREAD_MUTEX_INITIALIZER \ 39 { \ 40 /* .__timed = */ 0, /* .__recursive = */ 0, \ 41 /* .__robust = */ 0, /* .__owner = */ NULL, \ 42 /* .__lock_count = */ 0, \ 43 } 44 #endif 45 46 #define PTHREAD_RWLOCK_INITIALIZER \ 47 { \ 48 /* .__is_pshared = */ 0, \ 49 /* .__preference = */ 0, \ 50 /* .__state = */ 0, \ 51 /* .__write_tid = */ 0, \ 52 /* .__wait_queue_mutex = */ {0}, \ 53 /* .__pending_readers = */ {0}, \ 54 /* .__pending_writers = */ {0}, \ 55 /* .__reader_serialization = */ {0}, \ 56 /* .__writer_serialization = */ {0}, \ 57 } 58 59 // glibc extensions 60 #define PTHREAD_STACK_MIN (1 << 14) // 16KB 61 #define PTHREAD_RWLOCK_PREFER_READER_NP 0 62 #define PTHREAD_RWLOCK_PREFER_WRITER_NP 1 63 #define PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP 2 64 65 #endif // LLVM_LIBC_MACROS_PTHREAD_MACRO_H 66