summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <msvensson@maint1.mysql.com>2006-12-18 14:27:51 +0100
committerunknown <msvensson@maint1.mysql.com>2006-12-18 14:27:51 +0100
commitc4c6ab23c68c6bf47fc9b1e1fe93478db4d4ac27 (patch)
treea0c530ecf73d615f75a245a397668ab3be1cab57 /mysys
parent9121fa507fb109866ffe7c3c5ff5ceca3447da04 (diff)
parente403f0e774e5bec4bf1e878b88ff5ce2fed335e5 (diff)
downloadmariadb-git-c4c6ab23c68c6bf47fc9b1e1fe93478db4d4ac27.tar.gz
Merge maint1.mysql.com:/data/localhome/msvensson/mysql-5.0-maint
into maint1.mysql.com:/data/localhome/msvensson/mysql-5.1-new-maint mysql-test/r/symlink.result: Auto merged mysql-test/t/symlink.test: Auto merged include/my_pthread.h: Manual merge
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_wincond.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/mysys/my_wincond.c b/mysys/my_wincond.c
index 327addff2cc..b56dacc135a 100644
--- a/mysys/my_wincond.c
+++ b/mysys/my_wincond.c
@@ -37,7 +37,7 @@ int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
int pthread_cond_destroy(pthread_cond_t *cond)
{
- return CloseHandle(cond->semaphore) ? 0 : EINVAL;
+ return CloseHandle(cond->semaphore) ? 0 : EINVAL;
}
@@ -51,6 +51,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
return 0 ;
}
+
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
struct timespec *abstime)
{
@@ -61,26 +62,26 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
GetSystemTimeAsFileTime(&now.ft);
/*
- - subtract start time from current time(values are in 100ns units
+ Calculate time left to abstime
+ - subtract start time from current time(values are in 100ns units)
- convert to millisec by dividing with 10000
- - subtract time since start from max timeout
*/
- timeout= abstime->timeout_msec - (long)((now.i64 - abstime->start.i64) / 10000);
+ timeout= (long)((abstime->tv.i64 - now.i64) / 10000);
/* Don't allow the timeout to be negative */
if (timeout < 0)
- timeout = 0L;
+ timeout= 0L;
/*
- Make sure the calucated time does not exceed original timeout
+ Make sure the calucated timeout does not exceed original timeout
value which could cause "wait for ever" if system time changes
*/
- if (timeout > abstime->timeout_msec)
- timeout= abstime->timeout_msec;
+ if (timeout > abstime->max_timeout_msec)
+ timeout= abstime->max_timeout_msec;
InterlockedIncrement(&cond->waiting);
LeaveCriticalSection(mutex);
- result=WaitForSingleObject(cond->semaphore,timeout);
+ result= WaitForSingleObject(cond->semaphore,timeout);
InterlockedDecrement(&cond->waiting);
EnterCriticalSection(mutex);