ref: ad6429b9b53ca3afd18c55f2de3afb3e83c1d704
parent: 98528b7610cdaf8d2583c044d7104a86ceece35a
author: Henrik Gramner <[email protected]>
date: Mon Oct 1 11:22:16 EDT 2018
Windows: Fix conflicting pthread symbol names
--- a/src/thread.h
+++ b/src/thread.h
@@ -42,11 +42,15 @@
typedef void *pthread_condattr_t;
typedef void *pthread_attr_t;
-int pthread_create(pthread_t* thread, const pthread_attr_t* attr,
- void*(*proc)(void*), void* param);
-void pthread_join(pthread_t thread, void** res);
+int dav1d_pthread_create(pthread_t* thread, const pthread_attr_t* attr,
+ void*(*proc)(void*), void* param);
+void dav1d_pthread_join(pthread_t thread, void** res);
+int dav1d_pthread_once(pthread_once_t *once_control,
+ void (*init_routine)(void));
-int pthread_once(pthread_once_t *once_control, void (*init_routine)(void));
+#define pthread_create dav1d_pthread_create
+#define pthread_join dav1d_pthread_join
+#define pthread_once dav1d_pthread_once
static inline void pthread_mutex_init(pthread_mutex_t* mutex,
const pthread_mutexattr_t* attr)
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -49,8 +49,8 @@
return 0;
}
-int pthread_create(pthread_t* thread, const pthread_attr_t* attr,
- void*(*proc)(void*), void* param)
+int dav1d_pthread_create(pthread_t* thread, const pthread_attr_t* attr,
+ void*(*proc)(void*), void* param)
{
dav1d_win32_thread_t* th = *thread = malloc(sizeof(*th));
(void)attr;
@@ -69,7 +69,7 @@
return 0;
}
-void pthread_join(pthread_t thread, void** res) {
+void dav1d_pthread_join(pthread_t thread, void** res) {
dav1d_win32_thread_t* th = thread;
WaitForSingleObject(th->h, INFINITE);
@@ -78,7 +78,9 @@
free(th);
}
-int pthread_once(pthread_once_t *once_control, void (*init_routine)(void)) {
+int dav1d_pthread_once(pthread_once_t *once_control,
+ void (*init_routine)(void))
+{
BOOL fPending = FALSE;
BOOL fStatus;