From d166de6fb62c40784154bac37c00a7a68ad47daf Mon Sep 17 00:00:00 2001 From: divverent Date: Sat, 18 Feb 2012 11:19:13 +0000 Subject: [PATCH] actually fix the barrier typecasts... these really need to be volatile due to the b->called counter git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11696 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=3fbfd7e96ea812bb470aad0bc089ef7f03d3516f --- thread_pthread.c | 6 +++--- thread_sdl.c | 7 +++---- thread_win.c | 6 +++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/thread_pthread.c b/thread_pthread.c index 27ccf5fb..e86b2c38 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -182,7 +182,7 @@ typedef struct { void *_Thread_CreateBarrier(unsigned int count, const char *filename, int fileline) { - barrier_t *b = Z_Malloc(sizeof(barrier_t)); + volatile barrier_t *b = (volatile barrier_t *) Z_Malloc(sizeof(barrier_t)); #ifdef THREADDEBUG Sys_PrintfToTerminal("%p barrier create(%d) %s:%i\n", b, count, filename, fileline); #endif @@ -195,7 +195,7 @@ void *_Thread_CreateBarrier(unsigned int count, const char *filename, int fileli void _Thread_DestroyBarrier(void *barrier, const char *filename, int fileline) { - barrier_t *b = (barrier_t *) barrier; + volatile barrier_t *b = (volatile barrier_t *) barrier; #ifdef THREADDEBUG Sys_PrintfToTerminal("%p barrier destroy %s:%i\n", b, filename, fileline); #endif @@ -205,7 +205,7 @@ void _Thread_DestroyBarrier(void *barrier, const char *filename, int fileline) void _Thread_WaitBarrier(void *barrier, const char *filename, int fileline) { - barrier_t *b = (barrier_t *) barrier; + volatile barrier_t *b = (volatile barrier_t *) barrier; #ifdef THREADDEBUG Sys_PrintfToTerminal("%p barrier wait %s:%i\n", b, filename, fileline); #endif diff --git a/thread_sdl.c b/thread_sdl.c index ca729c35..d2567809 100644 --- a/thread_sdl.c +++ b/thread_sdl.c @@ -128,7 +128,7 @@ typedef struct { void *_Thread_CreateBarrier(unsigned int count, const char *filename, int fileline) { - barrier_t *b = (barrier_t *)Z_Malloc(sizeof(barrier_t)); + volatile barrier_t *b = (volatile barrier_t *) Z_Malloc(sizeof(barrier_t)); #ifdef THREADDEBUG Sys_PrintfToTerminal("%p barrier create(%d) %s:%i\n", b, count, filename, fileline); #endif @@ -141,7 +141,7 @@ void *_Thread_CreateBarrier(unsigned int count, const char *filename, int fileli void _Thread_DestroyBarrier(void *barrier, const char *filename, int fileline) { - barrier_t *b = (barrier_t *) barrier; + volatile barrier_t *b = (volatile barrier_t *) barrier; #ifdef THREADDEBUG Sys_PrintfToTerminal("%p barrier destroy %s:%i\n", b, filename, fileline); #endif @@ -151,7 +151,7 @@ void _Thread_DestroyBarrier(void *barrier, const char *filename, int fileline) void _Thread_WaitBarrier(void *barrier, const char *filename, int fileline) { - barrier_t *b = (barrier_t *) barrier; + volatile barrier_t *b = (volatile barrier_t *) barrier; #ifdef THREADDEBUG Sys_PrintfToTerminal("%p barrier wait %s:%i\n", b, filename, fileline); #endif @@ -167,4 +167,3 @@ void _Thread_WaitBarrier(void *barrier, const char *filename, int fileline) } Thread_UnlockMutex(b->mutex); } - diff --git a/thread_win.c b/thread_win.c index 692a6f11..8564ca19 100644 --- a/thread_win.c +++ b/thread_win.c @@ -262,7 +262,7 @@ typedef struct { void *_Thread_CreateBarrier(unsigned int count, const char *filename, int fileline) { - barrier_t *b = Z_Malloc(sizeof(barrier_t)); + volatile barrier_t *b = (volatile barrier_t *) Z_Malloc(sizeof(barrier_t)); #ifdef THREADDEBUG Sys_PrintfToTerminal("%p barrier create(%d) %s:%i\n", b, count, filename, fileline); #endif @@ -275,7 +275,7 @@ void *_Thread_CreateBarrier(unsigned int count, const char *filename, int fileli void _Thread_DestroyBarrier(void *barrier, const char *filename, int fileline) { - barrier_t *b = (barrier_t *) barrier; + volatile barrier_t *b = (volatile barrier_t *) barrier; #ifdef THREADDEBUG Sys_PrintfToTerminal("%p barrier destroy %s:%i\n", b, filename, fileline); #endif @@ -285,7 +285,7 @@ void _Thread_DestroyBarrier(void *barrier, const char *filename, int fileline) void _Thread_WaitBarrier(void *barrier, const char *filename, int fileline) { - barrier_t *b = (barrier_t *) barrier; + volatile barrier_t *b = (volatile barrier_t *) barrier; #ifdef THREADDEBUG Sys_PrintfToTerminal("%p barrier wait %s:%i\n", b, filename, fileline); #endif -- 2.39.2