[glib] Add headers



commit 4f3026ea230aeb73e5d24e9b8c72852c097e4354
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Sep 22 22:44:53 2011 -0400

    Add headers

 glib/tests/mutex.c     |   31 ++++++++++++++++++++++++++++++-
 glib/tests/rec-mutex.c |   28 +++++++++++++++++++++++++++-
 2 files changed, 57 insertions(+), 2 deletions(-)
---
diff --git a/glib/tests/mutex.c b/glib/tests/mutex.c
index 27fe4e7..2951d03 100644
--- a/glib/tests/mutex.c
+++ b/glib/tests/mutex.c
@@ -1,3 +1,25 @@
+/* Unit tests for GMutex
+ * Copyright (C) 2011 Red Hat, Inc
+ * Author: Matthias Clasen
+ *
+ * This work is provided "as is"; redistribution and modification
+ * in whole or in part, in any medium, physical or electronic is
+ * permitted without restriction.
+ *
+ * This work is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * In no event shall the authors or contributors be liable for any
+ * direct, indirect, incidental, special, exemplary, or consequential
+ * damages (including, but not limited to, procurement of substitute
+ * goods or services; loss of use, data, or profits; or business
+ * interruption) however caused and on any theory of liability, whether
+ * in contract, strict liability, or tort (including negligence or
+ * otherwise) arising in any way out of the use of this software, even
+ * if advised of the possibility of such damage.
+ */
+
 #include <glib.h>
 
 static void
@@ -8,6 +30,8 @@ test_mutex1 (void)
   g_mutex_init (&mutex);
   g_mutex_lock (&mutex);
   g_mutex_unlock (&mutex);
+  g_mutex_lock (&mutex);
+  g_mutex_unlock (&mutex);
   g_mutex_clear (&mutex);
 }
 
@@ -18,6 +42,8 @@ test_mutex2 (void)
 
   g_mutex_lock (&mutex);
   g_mutex_unlock (&mutex);
+  g_mutex_lock (&mutex);
+  g_mutex_unlock (&mutex);
   g_mutex_clear (&mutex);
 }
 
@@ -29,6 +55,8 @@ test_mutex3 (void)
   mutex = g_mutex_new ();
   g_mutex_lock (mutex);
   g_mutex_unlock (mutex);
+  g_mutex_lock (mutex);
+  g_mutex_unlock (mutex);
   g_mutex_free (mutex);
 }
 
@@ -41,8 +69,9 @@ test_mutex4 (void)
   ret = g_mutex_trylock (&mutex);
   g_assert (ret);
 
-  ret = g_mutex_trylock (&mutex);
   /* no guarantees that mutex is recursive, so could return 0 or 1 */
+  if (g_mutex_trylock (&mutex))
+    g_mutex_unlock (&mutex);
 
   g_mutex_unlock (&mutex);
   g_mutex_clear (&mutex);
diff --git a/glib/tests/rec-mutex.c b/glib/tests/rec-mutex.c
index 2b82ceb..e416d31 100644
--- a/glib/tests/rec-mutex.c
+++ b/glib/tests/rec-mutex.c
@@ -1,3 +1,25 @@
+/* Unit tests for GRecMutex
+ * Copyright (C) 2011 Red Hat, Inc
+ * Author: Matthias Clasen
+ *
+ * This work is provided "as is"; redistribution and modification
+ * in whole or in part, in any medium, physical or electronic is
+ * permitted without restriction.
+ *
+ * This work is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * In no event shall the authors or contributors be liable for any
+ * direct, indirect, incidental, special, exemplary, or consequential
+ * damages (including, but not limited to, procurement of substitute
+ * goods or services; loss of use, data, or profits; or business
+ * interruption) however caused and on any theory of liability, whether
+ * in contract, strict liability, or tort (including negligence or
+ * otherwise) arising in any way out of the use of this software, even
+ * if advised of the possibility of such damage.
+ */
+
 #include <glib.h>
 
 static void
@@ -8,6 +30,8 @@ test_rec_mutex1 (void)
   g_rec_mutex_init (&mutex);
   g_rec_mutex_lock (&mutex);
   g_rec_mutex_unlock (&mutex);
+  g_rec_mutex_lock (&mutex);
+  g_rec_mutex_unlock (&mutex);
   g_rec_mutex_clear (&mutex);
 }
 
@@ -18,6 +42,8 @@ test_rec_mutex2 (void)
 
   g_rec_mutex_lock (&mutex);
   g_rec_mutex_unlock (&mutex);
+  g_rec_mutex_lock (&mutex);
+  g_rec_mutex_unlock (&mutex);
   g_rec_mutex_clear (&mutex);
 }
 
@@ -34,7 +60,7 @@ test_rec_mutex3 (void)
   g_assert (ret);
 
   g_rec_mutex_unlock (&mutex);
-  g_rec_mutex_clear (&mutex);
+  g_rec_mutex_unlock (&mutex);
   g_rec_mutex_clear (&mutex);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]