mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
Fix memory barrier position in g_atomic_int_get and g_atomic_pointer_get.
2005-12-17 Sebastian Wilhelmi <seppi@seppi.de> * glib/gatomic.c: Fix memory barrier position in g_atomic_int_get and g_atomic_pointer_get. Add g_atomic_int_set and g_atomic_pointer_set implementations for the !DEFINE_WITH_MUTEXES && G_ATOMIC_OP_MEMORY_BARRIER_NEEDED case, as well as defining them as functions (additionally to the macros in the header) for the !G_ATOMIC_OP_MEMORY_BARRIER_NEEDED case.
This commit is contained in:
parent
63732bdf5e
commit
78568970db
@ -1,3 +1,12 @@
|
|||||||
|
2005-12-17 Sebastian Wilhelmi <seppi@seppi.de>
|
||||||
|
|
||||||
|
* glib/gatomic.c: Fix memory barrier position in g_atomic_int_get
|
||||||
|
and g_atomic_pointer_get. Add g_atomic_int_set and
|
||||||
|
g_atomic_pointer_set implementations for the !DEFINE_WITH_MUTEXES &&
|
||||||
|
G_ATOMIC_OP_MEMORY_BARRIER_NEEDED case, as well as defining them
|
||||||
|
as functions (additionally to the macros in the header) for the
|
||||||
|
!G_ATOMIC_OP_MEMORY_BARRIER_NEEDED case.
|
||||||
|
|
||||||
2005-12-16 Matthias Clasen <mclasen@redhat.com>
|
2005-12-16 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/gmem.c (g_allocator_new): Don't return a pointer to
|
* glib/gmem.c (g_allocator_new): Don't return a pointer to
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
2005-12-17 Sebastian Wilhelmi <seppi@seppi.de>
|
||||||
|
|
||||||
|
* glib/gatomic.c: Fix memory barrier position in g_atomic_int_get
|
||||||
|
and g_atomic_pointer_get. Add g_atomic_int_set and
|
||||||
|
g_atomic_pointer_set implementations for the !DEFINE_WITH_MUTEXES &&
|
||||||
|
G_ATOMIC_OP_MEMORY_BARRIER_NEEDED case, as well as defining them
|
||||||
|
as functions (additionally to the macros in the header) for the
|
||||||
|
!G_ATOMIC_OP_MEMORY_BARRIER_NEEDED case.
|
||||||
|
|
||||||
2005-12-16 Matthias Clasen <mclasen@redhat.com>
|
2005-12-16 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/gmem.c (g_allocator_new): Don't return a pointer to
|
* glib/gmem.c (g_allocator_new): Don't return a pointer to
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
2005-12-17 Sebastian Wilhelmi <seppi@seppi.de>
|
||||||
|
|
||||||
|
* glib/gatomic.c: Fix memory barrier position in g_atomic_int_get
|
||||||
|
and g_atomic_pointer_get. Add g_atomic_int_set and
|
||||||
|
g_atomic_pointer_set implementations for the !DEFINE_WITH_MUTEXES &&
|
||||||
|
G_ATOMIC_OP_MEMORY_BARRIER_NEEDED case, as well as defining them
|
||||||
|
as functions (additionally to the macros in the header) for the
|
||||||
|
!G_ATOMIC_OP_MEMORY_BARRIER_NEEDED case.
|
||||||
|
|
||||||
2005-12-16 Matthias Clasen <mclasen@redhat.com>
|
2005-12-16 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/gmem.c (g_allocator_new): Don't return a pointer to
|
* glib/gmem.c (g_allocator_new): Don't return a pointer to
|
||||||
|
@ -647,22 +647,32 @@ g_atomic_pointer_set (volatile gpointer *atomic,
|
|||||||
gint
|
gint
|
||||||
g_atomic_int_get (volatile gint *atomic)
|
g_atomic_int_get (volatile gint *atomic)
|
||||||
{
|
{
|
||||||
gint result = *atomic;
|
|
||||||
|
|
||||||
G_ATOMIC_MEMORY_BARRIER;
|
G_ATOMIC_MEMORY_BARRIER;
|
||||||
|
return *atomic;
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
void
|
||||||
|
g_atomic_int_set (volatile gint *atomic,
|
||||||
|
gint newval)
|
||||||
|
{
|
||||||
|
*atomic = newval;
|
||||||
|
G_ATOMIC_MEMORY_BARRIER;
|
||||||
}
|
}
|
||||||
|
|
||||||
gpointer
|
gpointer
|
||||||
g_atomic_pointer_get (volatile gpointer *atomic)
|
g_atomic_pointer_get (volatile gpointer *atomic)
|
||||||
{
|
{
|
||||||
gpointer result = *atomic;
|
|
||||||
|
|
||||||
G_ATOMIC_MEMORY_BARRIER;
|
G_ATOMIC_MEMORY_BARRIER;
|
||||||
|
return *atomic;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
g_atomic_pointer_set (volatile gpointer *atomic,
|
||||||
|
gpointer newval)
|
||||||
|
{
|
||||||
|
*atomic = newval;
|
||||||
|
G_ATOMIC_MEMORY_BARRIER;
|
||||||
|
}
|
||||||
#endif /* DEFINE_WITH_MUTEXES || G_ATOMIC_OP_MEMORY_BARRIER_NEEDED */
|
#endif /* DEFINE_WITH_MUTEXES || G_ATOMIC_OP_MEMORY_BARRIER_NEEDED */
|
||||||
|
|
||||||
#ifdef ATOMIC_INT_CMP_XCHG
|
#ifdef ATOMIC_INT_CMP_XCHG
|
||||||
@ -712,11 +722,25 @@ gint
|
|||||||
return g_atomic_int_get (atomic);
|
return g_atomic_int_get (atomic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
(g_atomic_int_set) (volatile gint *atomic,
|
||||||
|
gint newval)
|
||||||
|
{
|
||||||
|
g_atomic_int_set (atomic, newval);
|
||||||
|
}
|
||||||
|
|
||||||
gpointer
|
gpointer
|
||||||
(g_atomic_pointer_get) (volatile gpointer *atomic)
|
(g_atomic_pointer_get) (volatile gpointer *atomic)
|
||||||
{
|
{
|
||||||
return g_atomic_pointer_get (atomic);
|
return g_atomic_pointer_get (atomic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
(g_atomic_pointer_set) (volatile gpointer *atomic,
|
||||||
|
gpointer newval)
|
||||||
|
{
|
||||||
|
g_atomic_pointer_set (atomic, newval);
|
||||||
|
}
|
||||||
#endif /* G_ATOMIC_OP_MEMORY_BARRIER_NEEDED */
|
#endif /* G_ATOMIC_OP_MEMORY_BARRIER_NEEDED */
|
||||||
|
|
||||||
#define __G_ATOMIC_C__
|
#define __G_ATOMIC_C__
|
||||||
|
Loading…
Reference in New Issue
Block a user