mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 23:16:14 +01:00
Made recursive mutexes also work when the thread system is not (yet)
2000-11-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * gthread.c (g_static_rec_mutex_*): Made recursive mutexes also work when the thread system is not (yet) initialized.
This commit is contained in:
parent
292152dae2
commit
82ab77c8f7
@ -1,3 +1,8 @@
|
|||||||
|
2000-11-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gthread.c (g_static_rec_mutex_*): Made recursive mutexes also
|
||||||
|
work when the thread system is not (yet) initialized.
|
||||||
|
|
||||||
Sun Nov 12 18:34:32 2000 Owen Taylor <otaylor@redhat.com>
|
Sun Nov 12 18:34:32 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gconvert.[ch]: Create wrapper functions for iconv()
|
* gconvert.[ch]: Create wrapper functions for iconv()
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2000-11-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gthread.c (g_static_rec_mutex_*): Made recursive mutexes also
|
||||||
|
work when the thread system is not (yet) initialized.
|
||||||
|
|
||||||
Sun Nov 12 18:34:32 2000 Owen Taylor <otaylor@redhat.com>
|
Sun Nov 12 18:34:32 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gconvert.[ch]: Create wrapper functions for iconv()
|
* gconvert.[ch]: Create wrapper functions for iconv()
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2000-11-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gthread.c (g_static_rec_mutex_*): Made recursive mutexes also
|
||||||
|
work when the thread system is not (yet) initialized.
|
||||||
|
|
||||||
Sun Nov 12 18:34:32 2000 Owen Taylor <otaylor@redhat.com>
|
Sun Nov 12 18:34:32 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gconvert.[ch]: Create wrapper functions for iconv()
|
* gconvert.[ch]: Create wrapper functions for iconv()
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2000-11-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gthread.c (g_static_rec_mutex_*): Made recursive mutexes also
|
||||||
|
work when the thread system is not (yet) initialized.
|
||||||
|
|
||||||
Sun Nov 12 18:34:32 2000 Owen Taylor <otaylor@redhat.com>
|
Sun Nov 12 18:34:32 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gconvert.[ch]: Create wrapper functions for iconv()
|
* gconvert.[ch]: Create wrapper functions for iconv()
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2000-11-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gthread.c (g_static_rec_mutex_*): Made recursive mutexes also
|
||||||
|
work when the thread system is not (yet) initialized.
|
||||||
|
|
||||||
Sun Nov 12 18:34:32 2000 Owen Taylor <otaylor@redhat.com>
|
Sun Nov 12 18:34:32 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gconvert.[ch]: Create wrapper functions for iconv()
|
* gconvert.[ch]: Create wrapper functions for iconv()
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2000-11-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gthread.c (g_static_rec_mutex_*): Made recursive mutexes also
|
||||||
|
work when the thread system is not (yet) initialized.
|
||||||
|
|
||||||
Sun Nov 12 18:34:32 2000 Owen Taylor <otaylor@redhat.com>
|
Sun Nov 12 18:34:32 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gconvert.[ch]: Create wrapper functions for iconv()
|
* gconvert.[ch]: Create wrapper functions for iconv()
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2000-11-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gthread.c (g_static_rec_mutex_*): Made recursive mutexes also
|
||||||
|
work when the thread system is not (yet) initialized.
|
||||||
|
|
||||||
Sun Nov 12 18:34:32 2000 Owen Taylor <otaylor@redhat.com>
|
Sun Nov 12 18:34:32 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gconvert.[ch]: Create wrapper functions for iconv()
|
* gconvert.[ch]: Create wrapper functions for iconv()
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2000-11-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gthread.c (g_static_rec_mutex_*): Made recursive mutexes also
|
||||||
|
work when the thread system is not (yet) initialized.
|
||||||
|
|
||||||
Sun Nov 12 18:34:32 2000 Owen Taylor <otaylor@redhat.com>
|
Sun Nov 12 18:34:32 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gconvert.[ch]: Create wrapper functions for iconv()
|
* gconvert.[ch]: Create wrapper functions for iconv()
|
||||||
|
@ -166,6 +166,9 @@ g_static_rec_mutex_lock (GStaticRecMutex* mutex)
|
|||||||
|
|
||||||
g_return_if_fail (mutex);
|
g_return_if_fail (mutex);
|
||||||
|
|
||||||
|
if (!g_thread_supported ())
|
||||||
|
return;
|
||||||
|
|
||||||
G_THREAD_UF (thread_self, (&self));
|
G_THREAD_UF (thread_self, (&self));
|
||||||
|
|
||||||
if (g_system_thread_equal (self, mutex->owner))
|
if (g_system_thread_equal (self, mutex->owner))
|
||||||
@ -185,6 +188,9 @@ g_static_rec_mutex_trylock (GStaticRecMutex* mutex)
|
|||||||
|
|
||||||
g_return_val_if_fail (mutex, FALSE);
|
g_return_val_if_fail (mutex, FALSE);
|
||||||
|
|
||||||
|
if (!g_thread_supported ())
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
G_THREAD_UF (thread_self, (&self));
|
G_THREAD_UF (thread_self, (&self));
|
||||||
|
|
||||||
if (g_system_thread_equal (self, mutex->owner))
|
if (g_system_thread_equal (self, mutex->owner))
|
||||||
@ -206,6 +212,9 @@ g_static_rec_mutex_unlock (GStaticRecMutex* mutex)
|
|||||||
{
|
{
|
||||||
g_return_if_fail (mutex);
|
g_return_if_fail (mutex);
|
||||||
|
|
||||||
|
if (!g_thread_supported ())
|
||||||
|
return;
|
||||||
|
|
||||||
if (mutex->depth > 1)
|
if (mutex->depth > 1)
|
||||||
{
|
{
|
||||||
mutex->depth--;
|
mutex->depth--;
|
||||||
@ -221,6 +230,9 @@ g_static_rec_mutex_lock_full (GStaticRecMutex *mutex,
|
|||||||
{
|
{
|
||||||
g_return_if_fail (mutex);
|
g_return_if_fail (mutex);
|
||||||
|
|
||||||
|
if (!g_thread_supported ())
|
||||||
|
return;
|
||||||
|
|
||||||
g_static_mutex_lock (&mutex->mutex);
|
g_static_mutex_lock (&mutex->mutex);
|
||||||
G_THREAD_UF (thread_self, (&mutex->owner));
|
G_THREAD_UF (thread_self, (&mutex->owner));
|
||||||
mutex->depth = depth;
|
mutex->depth = depth;
|
||||||
@ -229,10 +241,15 @@ g_static_rec_mutex_lock_full (GStaticRecMutex *mutex,
|
|||||||
guint
|
guint
|
||||||
g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex)
|
g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex)
|
||||||
{
|
{
|
||||||
gint depth = mutex->depth;
|
gint depth;
|
||||||
|
|
||||||
g_return_val_if_fail (mutex, 0);
|
g_return_val_if_fail (mutex, 0);
|
||||||
|
|
||||||
|
if (!g_thread_supported ())
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
depth = mutex->depth;
|
||||||
|
|
||||||
g_system_thread_assign (mutex->owner, zero_thread);
|
g_system_thread_assign (mutex->owner, zero_thread);
|
||||||
mutex->depth = 0;
|
mutex->depth = 0;
|
||||||
g_static_mutex_unlock (&mutex->mutex);
|
g_static_mutex_unlock (&mutex->mutex);
|
||||||
|
19
gthread.c
19
gthread.c
@ -166,6 +166,9 @@ g_static_rec_mutex_lock (GStaticRecMutex* mutex)
|
|||||||
|
|
||||||
g_return_if_fail (mutex);
|
g_return_if_fail (mutex);
|
||||||
|
|
||||||
|
if (!g_thread_supported ())
|
||||||
|
return;
|
||||||
|
|
||||||
G_THREAD_UF (thread_self, (&self));
|
G_THREAD_UF (thread_self, (&self));
|
||||||
|
|
||||||
if (g_system_thread_equal (self, mutex->owner))
|
if (g_system_thread_equal (self, mutex->owner))
|
||||||
@ -185,6 +188,9 @@ g_static_rec_mutex_trylock (GStaticRecMutex* mutex)
|
|||||||
|
|
||||||
g_return_val_if_fail (mutex, FALSE);
|
g_return_val_if_fail (mutex, FALSE);
|
||||||
|
|
||||||
|
if (!g_thread_supported ())
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
G_THREAD_UF (thread_self, (&self));
|
G_THREAD_UF (thread_self, (&self));
|
||||||
|
|
||||||
if (g_system_thread_equal (self, mutex->owner))
|
if (g_system_thread_equal (self, mutex->owner))
|
||||||
@ -206,6 +212,9 @@ g_static_rec_mutex_unlock (GStaticRecMutex* mutex)
|
|||||||
{
|
{
|
||||||
g_return_if_fail (mutex);
|
g_return_if_fail (mutex);
|
||||||
|
|
||||||
|
if (!g_thread_supported ())
|
||||||
|
return;
|
||||||
|
|
||||||
if (mutex->depth > 1)
|
if (mutex->depth > 1)
|
||||||
{
|
{
|
||||||
mutex->depth--;
|
mutex->depth--;
|
||||||
@ -221,6 +230,9 @@ g_static_rec_mutex_lock_full (GStaticRecMutex *mutex,
|
|||||||
{
|
{
|
||||||
g_return_if_fail (mutex);
|
g_return_if_fail (mutex);
|
||||||
|
|
||||||
|
if (!g_thread_supported ())
|
||||||
|
return;
|
||||||
|
|
||||||
g_static_mutex_lock (&mutex->mutex);
|
g_static_mutex_lock (&mutex->mutex);
|
||||||
G_THREAD_UF (thread_self, (&mutex->owner));
|
G_THREAD_UF (thread_self, (&mutex->owner));
|
||||||
mutex->depth = depth;
|
mutex->depth = depth;
|
||||||
@ -229,10 +241,15 @@ g_static_rec_mutex_lock_full (GStaticRecMutex *mutex,
|
|||||||
guint
|
guint
|
||||||
g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex)
|
g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex)
|
||||||
{
|
{
|
||||||
gint depth = mutex->depth;
|
gint depth;
|
||||||
|
|
||||||
g_return_val_if_fail (mutex, 0);
|
g_return_val_if_fail (mutex, 0);
|
||||||
|
|
||||||
|
if (!g_thread_supported ())
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
depth = mutex->depth;
|
||||||
|
|
||||||
g_system_thread_assign (mutex->owner, zero_thread);
|
g_system_thread_assign (mutex->owner, zero_thread);
|
||||||
mutex->depth = 0;
|
mutex->depth = 0;
|
||||||
g_static_mutex_unlock (&mutex->mutex);
|
g_static_mutex_unlock (&mutex->mutex);
|
||||||
|
Loading…
Reference in New Issue
Block a user