void yaz_cond_create(YAZ_COND *p)
{
- *p = (YAZ_COND) malloc(sizeof(**p));
#ifdef WIN32
+ *p = (YAZ_COND) malloc(sizeof(**p));
InitializeConditionVariable(&(*p)->cond);
#elif YAZ_POSIX_THREADS
+ *p = (YAZ_COND) malloc(sizeof(**p));
pthread_cond_init(&(*p)->cond, 0);
+#else
+ *p = 0;
#endif
}
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);