mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 23:46:17 +01:00
Adapt to the changed prototype of InterlockedCompareExchange() in newer
2006-04-19 Tor Lillqvist <tml@novell.com> * glib/gatomic.c: Adapt to the changed prototype of InterlockedCompareExchange() in newer SDKs. Use InterlockedCompareExchangePointer() when applicable. (#155884, John Ehresman)
This commit is contained in:
parent
3ed15b72a9
commit
6f22c44259
@ -1,3 +1,10 @@
|
|||||||
|
2006-04-19 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
|
* glib/gatomic.c: Adapt to the changed prototype of
|
||||||
|
InterlockedCompareExchange() in newer SDKs. Use
|
||||||
|
InterlockedCompareExchangePointer() when applicable. (#155884,
|
||||||
|
John Ehresman)
|
||||||
|
|
||||||
2006-04-18 Matthias Clasen <mclasen@redhat.com>
|
2006-04-18 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/gkeyfile.h:
|
* glib/gkeyfile.h:
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2006-04-19 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
|
* glib/gatomic.c: Adapt to the changed prototype of
|
||||||
|
InterlockedCompareExchange() in newer SDKs. Use
|
||||||
|
InterlockedCompareExchangePointer() when applicable. (#155884,
|
||||||
|
John Ehresman)
|
||||||
|
|
||||||
2006-04-18 Matthias Clasen <mclasen@redhat.com>
|
2006-04-18 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/gkeyfile.h:
|
* glib/gkeyfile.h:
|
||||||
|
@ -495,6 +495,16 @@ g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic,
|
|||||||
|
|
||||||
#ifdef DEFINE_WITH_WIN32_INTERLOCKED
|
#ifdef DEFINE_WITH_WIN32_INTERLOCKED
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
|
/* Following indicates that InterlockedCompareExchangePointer is
|
||||||
|
* declared in winbase.h (included by windows.h) and needs to be
|
||||||
|
* commented out if not true. It is defined iff WINVER > 0x0400,
|
||||||
|
* which is usually correct but can be wrong if WINVER is set before
|
||||||
|
* windows.h is included.
|
||||||
|
*/
|
||||||
|
# if WINVER > 0x0400
|
||||||
|
# define HAVE_INTERLOCKED_COMPARE_EXCHANGE_POINTER
|
||||||
|
# endif
|
||||||
|
|
||||||
gint32
|
gint32
|
||||||
g_atomic_int_exchange_and_add (volatile gint32 *atomic,
|
g_atomic_int_exchange_and_add (volatile gint32 *atomic,
|
||||||
gint32 val)
|
gint32 val)
|
||||||
@ -514,9 +524,15 @@ g_atomic_int_compare_and_exchange (volatile gint32 *atomic,
|
|||||||
gint32 oldval,
|
gint32 oldval,
|
||||||
gint32 newval)
|
gint32 newval)
|
||||||
{
|
{
|
||||||
|
#ifndef HAVE_INTERLOCKED_COMPARE_EXCHANGE_POINTER
|
||||||
return (guint32) InterlockedCompareExchange ((PVOID*)atomic,
|
return (guint32) InterlockedCompareExchange ((PVOID*)atomic,
|
||||||
(PVOID)newval,
|
(PVOID)newval,
|
||||||
(PVOID)oldval) == oldval;
|
(PVOID)oldval) == oldval;
|
||||||
|
#else
|
||||||
|
return InterlockedCompareExchange (atomic,
|
||||||
|
newval,
|
||||||
|
oldval) == oldval;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@ -524,10 +540,14 @@ g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic,
|
|||||||
gpointer oldval,
|
gpointer oldval,
|
||||||
gpointer newval)
|
gpointer newval)
|
||||||
{
|
{
|
||||||
# if GLIB_SIZEOF_VOID_P != 4 /* no 32-bit system */
|
# ifdef HAVE_INTERLOCKED_COMPARE_EXCHANGE_POINTER
|
||||||
# error "InterlockedCompareExchangePointer needed"
|
return InterlockedCompareExchangePointer (atomic, newval, oldval) == oldval;
|
||||||
# else
|
# else
|
||||||
|
# if GLIB_SIZEOF_VOID_P != 4 /* no 32-bit system */
|
||||||
|
# error "InterlockedCompareExchangePointer needed"
|
||||||
|
# else
|
||||||
return InterlockedCompareExchange (atomic, newval, oldval) == oldval;
|
return InterlockedCompareExchange (atomic, newval, oldval) == oldval;
|
||||||
|
# endif
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
#endif /* DEFINE_WITH_WIN32_INTERLOCKED */
|
#endif /* DEFINE_WITH_WIN32_INTERLOCKED */
|
||||||
|
Loading…
Reference in New Issue
Block a user