From: divverent Date: Sat, 18 Feb 2012 11:19:13 +0000 (+0000) Subject: actually fix the barrier typecasts... these really need to be volatile due to the... X-Git-Tag: xonotic-v0.8.0~96^2~320 X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=3fbfd7e96ea812bb470aad0bc089ef7f03d3516f;hp=3a70eea8377d154832893fed9d0b26468c7ca148;p=xonotic%2Fdarkplaces.git 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 --- 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