winpthreads: Fix pthread_create_wrapper type - Make pthread_create_wrapper return an unsigned; _beginthreadindex takes a function returning an unsigned. The variable holding the return value of pthread_create_wrapper is already an unsigned. - Make pthread_create_wrapper __stdcall. Co-authored-by: Samuel Hym <samuel.hym@rustyne.lautre.net> Signed-off-by: Antonin Décimo <antonin@tarides.com> Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-libraries/winpthreads/include/pthread.h b/mingw-w64-libraries/winpthreads/include/pthread.h index 0ab7fef..cf3569a 100644 --- a/mingw-w64-libraries/winpthreads/include/pthread.h +++ b/mingw-w64-libraries/winpthreads/include/pthread.h
@@ -307,7 +307,7 @@ int WINPTHREAD_API _pthread_set_state(pthread_attr_t *attr, unsigned flag, unsigned val); int WINPTHREAD_API pthread_setcancelstate(int state, int *oldstate); int WINPTHREAD_API pthread_setcanceltype(int type, int *oldtype); -int WINPTHREAD_API pthread_create_wrapper(void *args); +unsigned WINPTHREAD_API __stdcall pthread_create_wrapper(void *args); int WINPTHREAD_API pthread_create(pthread_t *th, const pthread_attr_t *attr, void *(* func)(void *), void *arg); int WINPTHREAD_API pthread_join(pthread_t t, void **res); int WINPTHREAD_API pthread_detach(pthread_t t);
diff --git a/mingw-w64-libraries/winpthreads/src/thread.c b/mingw-w64-libraries/winpthreads/src/thread.c index b4bb2f0..99bb441 100644 --- a/mingw-w64-libraries/winpthreads/src/thread.c +++ b/mingw-w64-libraries/winpthreads/src/thread.c
@@ -1524,7 +1524,7 @@ __attribute__((force_align_arg_pointer)) # endif #endif -int +unsigned __stdcall pthread_create_wrapper (void *args) { unsigned rslt = 0; @@ -1665,7 +1665,7 @@ /* Make sure tv->h has value of INVALID_HANDLE_VALUE */ _ReadWriteBarrier(); - thrd = (HANDLE) _beginthreadex(NULL, ssize, (unsigned int (__stdcall *)(void *))pthread_create_wrapper, tv, 0x4/*CREATE_SUSPEND*/, NULL); + thrd = (HANDLE) _beginthreadex(NULL, ssize, pthread_create_wrapper, tv, 0x4/*CREATE_SUSPEND*/, NULL); if (thrd == INVALID_HANDLE_VALUE) thrd = 0; /* Failed */