+static void tst_cond(void)
+{
+ YAZ_MUTEX p = 0;
+ YAZ_COND c;
+ struct timespec abstime;
+ struct timeval tval;
+ int r;
+
+ yaz_mutex_create(&p);
+ YAZ_CHECK(p);
+ if (!p)
+ return;
+
+ yaz_cond_create(&c);
+ YAZ_CHECK(c);
+ if (!c)
+ return;
+
+ r = gettimeofday(&tval, 0);
+ YAZ_CHECK_EQ(r, 0);
+
+ abstime.tv_sec = tval.tv_sec + 1; /* wait 2 seconds */
+ abstime.tv_nsec = tval.tv_usec * 1000;
+
+ r = yaz_cond_wait(c, p, &abstime);
+ YAZ_CHECK(r != 0);
+
+ yaz_cond_destroy(&c);
+ YAZ_CHECK(c == 0);
+ yaz_mutex_destroy(&p);
+ YAZ_CHECK(p == 0);
+}
+