From: unknown Date: Wed, 19 May 2010 08:52:46 +0000 (+0200) Subject: Fix retval check of SleepConditionVariableCS X-Git-Tag: v4.0.9~3^2~9 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=6143ea31aa0013f8a835b979b8444ef691d0d208;p=yaz-moved-to-github.git Fix retval check of SleepConditionVariableCS SleepConditionVariableCS of Windows returns non-zero on success; zero on failure (opposite of pthread_cond_timedwait). --- diff --git a/src/condvar.c b/src/condvar.c index 5bbd92a..e6292bd 100644 --- a/src/condvar.c +++ b/src/condvar.c @@ -72,6 +72,7 @@ void yaz_cond_destroy(YAZ_COND *p) int yaz_cond_wait(YAZ_COND p, YAZ_MUTEX m, const struct timeval *abstime) { #ifdef WIN32 + BOOL v; if (abstime) { struct timeval tval_now; @@ -81,10 +82,11 @@ int yaz_cond_wait(YAZ_COND p, YAZ_MUTEX m, const struct timeval *abstime) sec = abstime->tv_sec - tval_now.tv_sec; msec = (abstime->tv_usec - tval_now.tv_usec) / 1000; - return SleepConditionVariableCS(&p->cond, &m->handle, sec*1000 + msec); + v = SleepConditionVariableCS(&p->cond, &m->handle, sec*1000 + msec); } else - return SleepConditionVariableCS(&p->cond, &m->handle, INFINITE); + v = SleepConditionVariableCS(&p->cond, &m->handle, INFINITE); + return v ? 0 : -1; #elif YAZ_POSIX_THREADS if (abstime) {