diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2012-05-23 17:13:56 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2012-05-23 17:13:56 +0400 |
commit | 2ca9ed527e8a18ff402e036174b2b003460fdf06 (patch) | |
tree | a023c3489333d615b1431194998003a1bf140bd9 /winsup/cygwin/winbase.h | |
parent | 420b3469a759ab126ba2ade71559e70bbddfeb2d (diff) |
* fhandler.h (refcnt): Add i interlocked. Explain why.
* winbase.h (ilockadd): New function.
(InterlockedAdd): Define as ilockadd.
Diffstat (limited to 'winsup/cygwin/winbase.h')
-rw-r--r-- | winsup/cygwin/winbase.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/winsup/cygwin/winbase.h b/winsup/cygwin/winbase.h index 00c71a923..4d92a9261 100644 --- a/winsup/cygwin/winbase.h +++ b/winsup/cygwin/winbase.h @@ -1,6 +1,6 @@ /* winbase.h - Copyright 2002, 2003, 2004, 2008 Red Hat, Inc. + Copyright 2002, 2003, 2004, 2008, 2012 Red Hat, Inc. This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for @@ -11,6 +11,21 @@ details. */ #ifndef _WINBASE2_H #define _WINBASE2_H +/* For some unknown reason, InterlockedAdd is only supported on Itanium + when using the Windows headers. Fortunately we're not restricted to the + Windows headers :) */ +extern __inline__ long +ilockadd (volatile long *m, long value) +{ + register int __res; + __asm__ __volatile__ ("\n\ + movl %3,%0\n\ + lock xadd %0,%1\n\ + addl %3,%0\n\ + ": "=&r" (__res), "=m" (*m): "m" (*m), "r" (value): "cc"); + return __res; +} + extern __inline__ long ilockincr (volatile long *m) { @@ -65,6 +80,8 @@ ilockcmpexch (volatile long *t, long v, long c) }); } +#undef InterlockedAdd +#define InterlockedAdd ilockadd #undef InterlockedIncrement #define InterlockedIncrement ilockincr #undef InterlockedDecrement |