|
|
|||
File indexing completed on 2026-05-03 08:14:04
0001 // -*- C++ -*- 0002 //===----------------------------------------------------------------------===// 0003 // 0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0005 // See https://llvm.org/LICENSE.txt for license information. 0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0007 // 0008 //===----------------------------------------------------------------------===// 0009 0010 #ifndef _LIBCPP___THREAD_SUPPORT_H 0011 #define _LIBCPP___THREAD_SUPPORT_H 0012 0013 #include <__config> 0014 0015 #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER 0016 # pragma GCC system_header 0017 #endif 0018 0019 /* 0020 0021 // 0022 // The library supports multiple implementations of the basic threading functionality. 0023 // The following functionality must be provided by any implementation: 0024 // 0025 0026 _LIBCPP_BEGIN_NAMESPACE_STD 0027 0028 using __libcpp_timespec_t = ...; 0029 0030 // 0031 // Mutex 0032 // 0033 using __libcpp_mutex_t = ...; 0034 #define _LIBCPP_MUTEX_INITIALIZER ... 0035 0036 using __libcpp_recursive_mutex_t = ...; 0037 0038 int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t*); 0039 _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t*); 0040 _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t*); 0041 _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t*); 0042 int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t*); 0043 0044 _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_lock(__libcpp_mutex_t*); 0045 _LIBCPP_NO_THREAD_SAFETY_ANALYSIS bool __libcpp_mutex_trylock(__libcpp_mutex_t*); 0046 _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_mutex_unlock(__libcpp_mutex_t*); 0047 int __libcpp_mutex_destroy(__libcpp_mutex_t*); 0048 0049 // 0050 // Condition Variable 0051 // 0052 using __libcpp_condvar_t = ...; 0053 #define _LIBCPP_CONDVAR_INITIALIZER ... 0054 0055 int __libcpp_condvar_signal(__libcpp_condvar_t*); 0056 int __libcpp_condvar_broadcast(__libcpp_condvar_t*); 0057 _LIBCPP_NO_THREAD_SAFETY_ANALYSIS int __libcpp_condvar_wait(__libcpp_condvar_t*, __libcpp_mutex_t*); 0058 _LIBCPP_NO_THREAD_SAFETY_ANALYSIS 0059 int __libcpp_condvar_timedwait(__libcpp_condvar_t*, __libcpp_mutex_t*, __libcpp_timespec_t*); 0060 int __libcpp_condvar_destroy(__libcpp_condvar_t*); 0061 0062 // 0063 // Execute once 0064 // 0065 using __libcpp_exec_once_flag = ...; 0066 #define _LIBCPP_EXEC_ONCE_INITIALIZER ... 0067 0068 int __libcpp_execute_once(__libcpp_exec_once_flag*, void (*__init_routine)()); 0069 0070 // 0071 // Thread id 0072 // 0073 using __libcpp_thread_id = ...; 0074 0075 bool __libcpp_thread_id_equal(__libcpp_thread_id, __libcpp_thread_id); 0076 bool __libcpp_thread_id_less(__libcpp_thread_id, __libcpp_thread_id); 0077 0078 // 0079 // Thread 0080 // 0081 #define _LIBCPP_NULL_THREAD ... 0082 using __libcpp_thread_t = ...; 0083 0084 bool __libcpp_thread_isnull(const __libcpp_thread_t*); 0085 int __libcpp_thread_create(__libcpp_thread_t*, void* (*__func)(void*), void* __arg); 0086 __libcpp_thread_id __libcpp_thread_get_current_id(); 0087 __libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t*); 0088 int __libcpp_thread_join(__libcpp_thread_t*); 0089 int __libcpp_thread_detach(__libcpp_thread_t*); 0090 void __libcpp_thread_yield(); 0091 void __libcpp_thread_sleep_for(const chrono::nanoseconds&); 0092 0093 // 0094 // Thread local storage 0095 // 0096 #define _LIBCPP_TLS_DESTRUCTOR_CC ... 0097 using __libcpp_tls_key = ...; 0098 0099 int __libcpp_tls_create(__libcpp_tls_key*, void (*__at_exit)(void*)); 0100 void* __libcpp_tls_get(__libcpp_tls_key); 0101 int __libcpp_tls_set(__libcpp_tls_key, void*); 0102 0103 _LIBCPP_END_NAMESPACE_STD 0104 0105 */ 0106 0107 #if _LIBCPP_HAS_THREADS 0108 0109 # if _LIBCPP_HAS_THREAD_API_EXTERNAL 0110 # include <__thread/support/external.h> 0111 # elif _LIBCPP_HAS_THREAD_API_PTHREAD 0112 # include <__thread/support/pthread.h> 0113 # elif _LIBCPP_HAS_THREAD_API_C11 0114 # include <__thread/support/c11.h> 0115 # elif _LIBCPP_HAS_THREAD_API_WIN32 0116 # include <__thread/support/windows.h> 0117 # else 0118 # error "No threading API was selected" 0119 # endif 0120 0121 #endif // _LIBCPP_HAS_THREADS 0122 0123 #endif // _LIBCPP___THREAD_SUPPORT_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|