projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ignore trs files
[yaz-moved-to-github.git]
/
src
/
condvar.c
diff --git
a/src/condvar.c
b/src/condvar.c
index
5bbd92a
..
2e44efa
100644
(file)
--- a/
src/condvar.c
+++ b/
src/condvar.c
@@
-1,5
+1,5
@@
/* This file is part of the YAZ toolkit.
/* 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.
*/
* See the file LICENSE for details.
*/
@@
-48,11
+48,14
@@
struct yaz_cond {
void yaz_cond_create(YAZ_COND *p)
{
void yaz_cond_create(YAZ_COND *p)
{
- *p = (YAZ_COND) malloc(sizeof(**p));
#ifdef WIN32
#ifdef WIN32
+ *p = (YAZ_COND) malloc(sizeof(**p));
InitializeConditionVariable(&(*p)->cond);
#elif YAZ_POSIX_THREADS
InitializeConditionVariable(&(*p)->cond);
#elif YAZ_POSIX_THREADS
+ *p = (YAZ_COND) malloc(sizeof(**p));
pthread_cond_init(&(*p)->cond, 0);
pthread_cond_init(&(*p)->cond, 0);
+#else
+ *p = 0;
#endif
}
#endif
}
@@
-72,6
+75,7
@@
void yaz_cond_destroy(YAZ_COND *p)
int yaz_cond_wait(YAZ_COND p, YAZ_MUTEX m, const struct timeval *abstime)
{
#ifdef WIN32
int yaz_cond_wait(YAZ_COND p, YAZ_MUTEX m, const struct timeval *abstime)
{
#ifdef WIN32
+ BOOL v;
if (abstime)
{
struct timeval tval_now;
if (abstime)
{
struct timeval tval_now;
@@
-81,10
+85,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;
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
}
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)
{
#elif YAZ_POSIX_THREADS
if (abstime)
{