c11: #include <threads.h> when the os/platform provide it
Closes #6964 CC: mesa-stable Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18043>
This commit is contained in:
@@ -22,7 +22,9 @@ files_mesa_util_c11 = files(
|
||||
'time.c',
|
||||
)
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
if with_c11_threads
|
||||
# no need implement c11 threads
|
||||
elif host_machine.system() == 'windows'
|
||||
files_mesa_util_c11 += 'threads_win32.c'
|
||||
files_mesa_util_c11 += 'threads_win32_tls_callback.cpp'
|
||||
else
|
||||
|
||||
@@ -47,6 +47,20 @@
|
||||
# error Not supported on this platform.
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_THRD_CREATE)
|
||||
#include <threads.h>
|
||||
|
||||
#if defined(ANDROID)
|
||||
/* Currently, only Android are verified that it's thrd_t are typedef of pthread_t
|
||||
* So we can define _MTX_INITIALIZER_NP to PTHREAD_MUTEX_INITIALIZER
|
||||
* FIXME: temporary non-standard hack to ease transition
|
||||
*/
|
||||
# define _MTX_INITIALIZER_NP PTHREAD_MUTEX_INITIALIZER
|
||||
#else
|
||||
#error Can not define _MTX_INITIALIZER_NP properly for this platform
|
||||
#endif
|
||||
#else
|
||||
|
||||
/*---------------------------- macros ---------------------------*/
|
||||
|
||||
#ifndef _Thread_local
|
||||
@@ -185,4 +199,6 @@ int tss_set(tss_t, void *);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_THRD_CREATE */
|
||||
|
||||
#endif /* C11_THREADS_H_INCLUDED_ */
|
||||
|
||||
Reference in New Issue
Block a user