From a94555ec0f78ebd0a5a315211e3d44f6b6e77df5 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 23 Oct 2012 10:17:29 +0000 Subject: [PATCH] * thread.h (List_insert): Cast first parameter in InterlockedCompareExchangePointer call to avoid compiler warnings. (List_remove): Ditto. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/thread.h | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index ad74f7ea0..9a8c4380e 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2012-10-23 Corinna Vinschen + + * thread.h (List_insert): Cast first parameter in + InterlockedCompareExchangePointer call to avoid compiler warnings. + (List_remove): Ditto. + 2012-10-22 Corinna Vinschen * winbase.h: Remove. diff --git a/winsup/cygwin/thread.h b/winsup/cygwin/thread.h index 07652758c..a0412e1d0 100644 --- a/winsup/cygwin/thread.h +++ b/winsup/cygwin/thread.h @@ -59,18 +59,18 @@ public: void lock () { - if (InterlockedIncrement ((long *) &lock_counter) != 1) + if (InterlockedIncrement (&lock_counter) != 1) cygwait (win32_obj_id, cw_infinite, cw_sig); } void unlock () { - if (InterlockedDecrement ((long *) &lock_counter)) + if (InterlockedDecrement (&lock_counter)) ::SetEvent (win32_obj_id); } private: - unsigned long lock_counter; + LONG lock_counter; HANDLE win32_obj_id; }; @@ -119,18 +119,20 @@ List_insert (list_node *&head, list_node *node) return; do node->next = head; - while (InterlockedCompareExchangePointer (&head, node, node->next) != node->next); + while (InterlockedCompareExchangePointer ((PVOID volatile *) &head, + node, node->next) != node->next); } template inline void -List_remove (fast_mutex &mx, list_node *&head, list_node const *node) +List_remove (fast_mutex &mx, list_node *&head, list_node *node) { if (!node) return; mx.lock (); if (head) { - if (InterlockedCompareExchangePointer (&head, node->next, node) != node) + if (InterlockedCompareExchangePointer ((PVOID volatile *) &head, + node->next, node) != node) { list_node *cur = head; @@ -297,7 +299,7 @@ public: } protected: - unsigned long lock_counter; + LONG lock_counter; HANDLE win32_obj_id; pthread_t owner; #ifdef DEBUGGING @@ -680,7 +682,7 @@ struct MTinterface { // General int concurrency; - long int threadcount; + LONG threadcount; callback *pthread_prepare; callback *pthread_child;