3 Copyright 2002, 2003, 2004, 2008 Red Hat, Inc.
5 This software is a copyrighted work licensed under the terms of the
6 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
9 #include_next "winbase.h"
14 extern __inline__ long
15 ilockincr (volatile long *m)
18 __asm__ __volatile__ ("\n\
22 ": "=&r" (__res), "=m" (*m): "m" (*m): "cc");
26 extern __inline__ long
27 ilockdecr (volatile long *m)
30 __asm__ __volatile__ ("\n\
31 movl $0xffffffff,%0\n\
34 ": "=&r" (__res), "=m" (*m): "m" (*m): "cc");
38 extern __inline__ long
39 ilockexch (volatile long *t, long v)
43 register long ret __asm ("%eax");
44 __asm __volatile ("\n"
45 "1: lock cmpxchgl %2, %1\n"
47 : "=a" (ret), "=m" (*t)
48 : "r" (v), "m" (*t), "0" (*t)
54 extern __inline__ long
55 ilockcmpexch (volatile long *t, long v, long c)
59 register long ret __asm ("%eax");
60 __asm __volatile ("lock cmpxchgl %2, %1"
61 : "=a" (ret), "=m" (*t)
62 : "r" (v), "m" (*t), "0" (c)
68 #undef InterlockedIncrement
69 #define InterlockedIncrement ilockincr
70 #undef InterlockedDecrement
71 #define InterlockedDecrement ilockdecr
72 #undef InterlockedExchange
73 #define InterlockedExchange ilockexch
74 #undef InterlockedCompareExchange
75 #define InterlockedCompareExchange ilockcmpexch
76 #endif /*_WINBASE2_H*/