g_rw_lock_clear (&lock);
}
+static void
+test_rwlock4 (void)
+{
+ GRWLock lock = G_RW_LOCK_INIT;
+
+ g_rw_lock_reader_lock (&lock);
+ g_rw_lock_reader_unlock (&lock);
+ g_rw_lock_reader_lock (&lock);
+ g_rw_lock_reader_unlock (&lock);
+ g_rw_lock_clear (&lock);
+}
+
+static void
+test_rwlock5 (void)
+{
+ GRWLock lock = G_RW_LOCK_INIT;
+ gboolean ret;
+
+ ret = g_rw_lock_reader_trylock (&lock);
+ g_assert (ret);
+ ret = g_rw_lock_reader_trylock (&lock);
+ g_assert (ret);
+
+ g_rw_lock_reader_unlock (&lock);
+ g_rw_lock_reader_unlock (&lock);
+
+ g_rw_lock_clear (&lock);
+}
+
+static void
+test_rwlock6 (void)
+{
+ GRWLock lock = G_RW_LOCK_INIT;
+ gboolean ret;
+
+ g_rw_lock_writer_lock (&lock);
+ ret = g_rw_lock_reader_trylock (&lock);
+ g_assert (!ret);
+ g_rw_lock_writer_unlock (&lock);
+
+ g_rw_lock_reader_lock (&lock);
+ ret = g_rw_lock_writer_trylock (&lock);
+ g_assert (!ret);
+ g_rw_lock_reader_unlock (&lock);
+
+ g_rw_lock_clear (&lock);
+}
int
main (int argc, char *argv[])
g_test_add_func ("/thread/rwlock1", test_rwlock1);
g_test_add_func ("/thread/rwlock2", test_rwlock2);
g_test_add_func ("/thread/rwlock3", test_rwlock3);
+ g_test_add_func ("/thread/rwlock4", test_rwlock4);
+ g_test_add_func ("/thread/rwlock5", test_rwlock5);
+ g_test_add_func ("/thread/rwlock6", test_rwlock6);
return g_test_run ();
}