- 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....@rustyne.lautre.net>
Signed-off-by: Antonin Décimo <anto...@tarides.com>
---
 mingw-w64-libraries/winpthreads/include/pthread.h | 2 +-
 mingw-w64-libraries/winpthreads/src/thread.c      | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/mingw-w64-libraries/winpthreads/include/pthread.h 
b/mingw-w64-libraries/winpthreads/include/pthread.h
index 0ab7fef11..4ce815c64 100644
--- a/mingw-w64-libraries/winpthreads/include/pthread.h
+++ b/mingw-w64-libraries/winpthreads/include/pthread.h
@@ -307,7 +307,7 @@ unsigned  WINPTHREAD_API _pthread_get_state(const 
pthread_attr_t *attr, unsigned
 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 WINAPI 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 b4bb2f048..245bc52a6 100644
--- a/mingw-w64-libraries/winpthreads/src/thread.c
+++ b/mingw-w64-libraries/winpthreads/src/thread.c
@@ -1524,7 +1524,7 @@ void _fpreset (void);
 __attribute__((force_align_arg_pointer))
 #  endif
 #endif
-int
+unsigned WINAPI
 pthread_create_wrapper (void *args)
 {
   unsigned rslt = 0;
@@ -1665,7 +1665,7 @@ pthread_create (pthread_t *th, const pthread_attr_t 
*attr, void *(* func)(void *
   /* 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 */
-- 
2.43.0



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to