X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=test%2Ftest_mutex.c;h=0a7798f5c0923963fef66b427f95451d17ced978;hp=6a0b9f140b4413bddfd60edce218f019ad1f5599;hb=33d0d214a9219e190e15779b4e4f5e31fd7946be;hpb=a4f3aed6537286535d1ea9962adb9ab77c528565 diff --git a/test/test_mutex.c b/test/test_mutex.c index 6a0b9f1..0a7798f 100644 --- a/test/test_mutex.c +++ b/test/test_mutex.c @@ -1,7 +1,10 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2010 Index Data + * Copyright (C) 1995-2013 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -54,18 +57,17 @@ static void tst_cond(void) return; yaz_cond_create(&c); - YAZ_CHECK(c); - if (!c) - return; + if (c) + { + r = yaz_gettimeofday(&abstime); + YAZ_CHECK_EQ(r, 0); + + abstime.tv_sec += 1; /* wait 1 second */ - 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); + r = yaz_cond_wait(c, p, &abstime); + YAZ_CHECK(r != 0); + } yaz_cond_destroy(&c); YAZ_CHECK(c == 0); yaz_mutex_destroy(&p); @@ -89,7 +91,7 @@ static void tst_create_thread(void) YAZ_CHECK(t[0]); t[1] = yaz_thread_create(my_handler, &mydata); YAZ_CHECK(t[1]); - + return_data = 0; yaz_thread_join(&t[0], &return_data); YAZ_CHECK(!t[0]); @@ -99,7 +101,7 @@ static void tst_create_thread(void) yaz_thread_join(&t[1], &return_data); YAZ_CHECK(!t[1]); YAZ_CHECK(return_data == &mydata); - + YAZ_CHECK_EQ(mydata, 44); }