CCL: add tests for CCL s=ag
[yaz-moved-to-github.git] / test / test_mutex.c
index 6a0b9f1..3664a36 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2012 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -54,18 +57,17 @@ static void tst_cond(void)
         return;
 
     yaz_cond_create(&c);
-    YAZ_CHECK(c);
-    if (!c)
-        return;
-
-    r = yaz_gettimeofday(&abstime);
-    YAZ_CHECK_EQ(r, 0);
-    
-    abstime.tv_sec += 1; /* wait 1 second */
-    
-    r = yaz_cond_wait(c, p, &abstime);
-    YAZ_CHECK(r != 0);
-
+    if (c)
+    {
+        r = yaz_gettimeofday(&abstime);
+        YAZ_CHECK_EQ(r, 0);
+        
+        abstime.tv_sec += 1; /* wait 1 second */
+        
+        r = yaz_cond_wait(c, p, &abstime);
+        YAZ_CHECK(r != 0);
+
+    }
     yaz_cond_destroy(&c);
     YAZ_CHECK(c == 0);
     yaz_mutex_destroy(&p);