* thread.h (List_insert): Cast first parameter in

InterlockedCompareExchangePointer call to avoid compiler warnings.
	(List_remove): Ditto.
This commit is contained in:
Corinna Vinschen 2012-10-23 10:17:29 +00:00
parent cdc5dd85f1
commit a94555ec0f
2 changed files with 16 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2012-10-23 Corinna Vinschen <corinna@vinschen.de>
* thread.h (List_insert): Cast first parameter in
InterlockedCompareExchangePointer call to avoid compiler warnings.
(List_remove): Ditto.
2012-10-22 Corinna Vinschen <corinna@vinschen.de> 2012-10-22 Corinna Vinschen <corinna@vinschen.de>
* winbase.h: Remove. * winbase.h: Remove.

View File

@ -59,18 +59,18 @@ public:
void lock () void lock ()
{ {
if (InterlockedIncrement ((long *) &lock_counter) != 1) if (InterlockedIncrement (&lock_counter) != 1)
cygwait (win32_obj_id, cw_infinite, cw_sig); cygwait (win32_obj_id, cw_infinite, cw_sig);
} }
void unlock () void unlock ()
{ {
if (InterlockedDecrement ((long *) &lock_counter)) if (InterlockedDecrement (&lock_counter))
::SetEvent (win32_obj_id); ::SetEvent (win32_obj_id);
} }
private: private:
unsigned long lock_counter; LONG lock_counter;
HANDLE win32_obj_id; HANDLE win32_obj_id;
}; };
@ -119,18 +119,20 @@ List_insert (list_node *&head, list_node *node)
return; return;
do do
node->next = head; node->next = head;
while (InterlockedCompareExchangePointer (&head, node, node->next) != node->next); while (InterlockedCompareExchangePointer ((PVOID volatile *) &head,
node, node->next) != node->next);
} }
template <class list_node> inline void template <class list_node> 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) if (!node)
return; return;
mx.lock (); mx.lock ();
if (head) if (head)
{ {
if (InterlockedCompareExchangePointer (&head, node->next, node) != node) if (InterlockedCompareExchangePointer ((PVOID volatile *) &head,
node->next, node) != node)
{ {
list_node *cur = head; list_node *cur = head;
@ -297,7 +299,7 @@ public:
} }
protected: protected:
unsigned long lock_counter; LONG lock_counter;
HANDLE win32_obj_id; HANDLE win32_obj_id;
pthread_t owner; pthread_t owner;
#ifdef DEBUGGING #ifdef DEBUGGING
@ -680,7 +682,7 @@ struct MTinterface
{ {
// General // General
int concurrency; int concurrency;
long int threadcount; LONG threadcount;
callback *pthread_prepare; callback *pthread_prepare;
callback *pthread_child; callback *pthread_child;