mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-04 21:16:52 +02:00
Use g_atomic_pointer_set instead of old homegrown version now that we have
2006-05-10 Sebastian Wilhelmi <wilhelmi@google.com> * glib/gthread.c: Use g_atomic_pointer_set instead of old homegrown version now that we have it. (#335198, Chris Wilson)
This commit is contained in:
parent
685da6b099
commit
a93560b83d
@ -1,5 +1,8 @@
|
|||||||
2006-05-10 Sebastian Wilhelmi <wilhelmi@google.com>
|
2006-05-10 Sebastian Wilhelmi <wilhelmi@google.com>
|
||||||
|
|
||||||
|
* glib/gthread.c: Use g_atomic_pointer_set instead of old
|
||||||
|
homegrown version now that we have it. (#335198, Chris Wilson)
|
||||||
|
|
||||||
* gthread/gthread-posix.c, gthread/gthread-win32.c: Prevent
|
* gthread/gthread-posix.c, gthread/gthread-win32.c: Prevent
|
||||||
calling into g_cond_wait resp. g_mutex_lock/unlock directly to
|
calling into g_cond_wait resp. g_mutex_lock/unlock directly to
|
||||||
avoid recursions into the errorcheking mutex code (and out of
|
avoid recursions into the errorcheking mutex code (and out of
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
2006-05-10 Sebastian Wilhelmi <wilhelmi@google.com>
|
2006-05-10 Sebastian Wilhelmi <wilhelmi@google.com>
|
||||||
|
|
||||||
|
* glib/gthread.c: Use g_atomic_pointer_set instead of old
|
||||||
|
homegrown version now that we have it. (#335198, Chris Wilson)
|
||||||
|
|
||||||
* gthread/gthread-posix.c, gthread/gthread-win32.c: Prevent
|
* gthread/gthread-posix.c, gthread/gthread-win32.c: Prevent
|
||||||
calling into g_cond_wait resp. g_mutex_lock/unlock directly to
|
calling into g_cond_wait resp. g_mutex_lock/unlock directly to
|
||||||
avoid recursions into the errorcheking mutex code (and out of
|
avoid recursions into the errorcheking mutex code (and out of
|
||||||
|
@ -203,16 +203,7 @@ g_static_mutex_get_mutex_impl (GMutex** mutex)
|
|||||||
g_mutex_lock (g_once_mutex);
|
g_mutex_lock (g_once_mutex);
|
||||||
|
|
||||||
if (!(*mutex))
|
if (!(*mutex))
|
||||||
{
|
g_atomic_pointer_set (mutex, g_mutex_new());
|
||||||
GMutex *new_mutex = g_mutex_new ();
|
|
||||||
|
|
||||||
/* The following is a memory barrier to avoid the write
|
|
||||||
* to *new_mutex being reordered to after writing *mutex */
|
|
||||||
g_mutex_lock (new_mutex);
|
|
||||||
g_mutex_unlock (new_mutex);
|
|
||||||
|
|
||||||
*mutex = new_mutex;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_mutex_unlock (g_once_mutex);
|
g_mutex_unlock (g_once_mutex);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user