2001-08-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+ * glib/gthread.h, glib/gthread.c: Add 'want_to_read' to
+ GStaticRWLock to avoid calling g_cond_broadcast, when no one is
+ waiting.
+
* glib/gmain.c (g_main_context_add_poll_unlocked): Don't free
cached_poll_array, when adding new poll's. This is taken care for
in g_main_context_iterate.
2001-08-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+ * glib/gthread.h, glib/gthread.c: Add 'want_to_read' to
+ GStaticRWLock to avoid calling g_cond_broadcast, when no one is
+ waiting.
+
* glib/gmain.c (g_main_context_add_poll_unlocked): Don't free
cached_poll_array, when adding new poll's. This is taken care for
in g_main_context_iterate.
2001-08-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+ * glib/gthread.h, glib/gthread.c: Add 'want_to_read' to
+ GStaticRWLock to avoid calling g_cond_broadcast, when no one is
+ waiting.
+
* glib/gmain.c (g_main_context_add_poll_unlocked): Don't free
cached_poll_array, when adding new poll's. This is taken care for
in g_main_context_iterate.
2001-08-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+ * glib/gthread.h, glib/gthread.c: Add 'want_to_read' to
+ GStaticRWLock to avoid calling g_cond_broadcast, when no one is
+ waiting.
+
* glib/gmain.c (g_main_context_add_poll_unlocked): Don't free
cached_poll_array, when adding new poll's. This is taken care for
in g_main_context_iterate.
2001-08-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+ * glib/gthread.h, glib/gthread.c: Add 'want_to_read' to
+ GStaticRWLock to avoid calling g_cond_broadcast, when no one is
+ waiting.
+
* glib/gmain.c (g_main_context_add_poll_unlocked): Don't free
cached_poll_array, when adding new poll's. This is taken care for
in g_main_context_iterate.
2001-08-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+ * glib/gthread.h, glib/gthread.c: Add 'want_to_read' to
+ GStaticRWLock to avoid calling g_cond_broadcast, when no one is
+ waiting.
+
* glib/gmain.c (g_main_context_add_poll_unlocked): Don't free
cached_poll_array, when adding new poll's. This is taken care for
in g_main_context_iterate.
2001-08-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+ * glib/gthread.h, glib/gthread.c: Add 'want_to_read' to
+ GStaticRWLock to avoid calling g_cond_broadcast, when no one is
+ waiting.
+
* glib/gmain.c (g_main_context_add_poll_unlocked): Don't free
cached_poll_array, when adding new poll's. This is taken care for
in g_main_context_iterate.
2001-08-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+ * glib/gthread.h, glib/gthread.c: Add 'want_to_read' to
+ GStaticRWLock to avoid calling g_cond_broadcast, when no one is
+ waiting.
+
* glib/gmain.c (g_main_context_add_poll_unlocked): Don't free
cached_poll_array, when adding new poll's. This is taken care for
in g_main_context_iterate.
{
if (lock->want_to_write && lock->write_cond)
g_cond_signal (lock->write_cond);
- else if (lock->read_cond)
+ else if (lock->want_to_read && lock->read_cond)
g_cond_broadcast (lock->read_cond);
}
return;
g_static_mutex_lock (&lock->mutex);
+ lock->want_to_read++;
while (lock->write || lock->want_to_write)
g_static_rw_lock_wait (&lock->read_cond, &lock->mutex);
+ lock->want_to_read--;
lock->read_counter++;
g_static_mutex_unlock (&lock->mutex);
}
GCond *write_cond;
guint read_counter;
gboolean write;
+ guint want_to_read;
guint want_to_write;
};
-#define G_STATIC_RW_LOCK_INIT { G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, FALSE }
+#define G_STATIC_RW_LOCK_INIT { G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, 0, 0 }
void g_static_rw_lock_init (GStaticRWLock* lock);
void g_static_rw_lock_reader_lock (GStaticRWLock* lock);