summaryrefslogtreecommitdiff
path: root/mysys/my_wincond.c
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-10-19 21:45:18 +0200
committerSergei Golubchik <sergii@pisem.net>2011-10-19 21:45:18 +0200
commit76f0b94bb0b2994d639353530c5b251d0f1a204b (patch)
tree9ed50628aac34f89a37637bab2fc4915b86b5eb4 /mysys/my_wincond.c
parent4e46d8e5bff140f2549841167dc4b65a3c0a645d (diff)
parent5dc1a2231f55bacc9aaf0e24816f3d9c2ee1f21d (diff)
downloadmariadb-git-76f0b94bb0b2994d639353530c5b251d0f1a204b.tar.gz
merge with 5.3
sql/sql_insert.cc: CREATE ... IF NOT EXISTS may do nothing, but it is still not a failure. don't forget to my_ok it. ****** CREATE ... IF NOT EXISTS may do nothing, but it is still not a failure. don't forget to my_ok it. sql/sql_table.cc: small cleanup ****** small cleanup
Diffstat (limited to 'mysys/my_wincond.c')
-rw-r--r--mysys/my_wincond.c46
1 files changed, 15 insertions, 31 deletions
diff --git a/mysys/my_wincond.c b/mysys/my_wincond.c
index 58c09e332d6..bed64230aea 100644
--- a/mysys/my_wincond.c
+++ b/mysys/my_wincond.c
@@ -31,7 +31,7 @@
*/
/* Prototypes and function pointers for condition variable functions */
-typedef VOID (WINAPI * InitializeConditionVariableProc)
+typedef void (WINAPI * InitializeConditionVariableProc)
(PCONDITION_VARIABLE ConditionVariable);
typedef BOOL (WINAPI * SleepConditionVariableCSProc)
@@ -39,10 +39,10 @@ typedef BOOL (WINAPI * SleepConditionVariableCSProc)
PCRITICAL_SECTION CriticalSection,
DWORD dwMilliseconds);
-typedef VOID (WINAPI * WakeAllConditionVariableProc)
+typedef void (WINAPI * WakeAllConditionVariableProc)
(PCONDITION_VARIABLE ConditionVariable);
-typedef VOID (WINAPI * WakeConditionVariableProc)
+typedef void (WINAPI * WakeConditionVariableProc)
(PCONDITION_VARIABLE ConditionVariable);
static InitializeConditionVariableProc my_InitializeConditionVariable;
@@ -88,36 +88,20 @@ static void check_native_cond_availability(void)
static DWORD get_milliseconds(const struct timespec *abstime)
{
- long long millis;
- union ft64 now;
+ struct timespec current_time;
+ long long ms;
if (abstime == NULL)
- return INFINITE;
-
- GetSystemTimeAsFileTime(&now.ft);
-
- /*
- Calculate time left to abstime
- - subtract start time from current time(values are in 100ns units)
- - convert to millisec by dividing with 10000
- */
- millis= (abstime->tv.i64 - now.i64) / 10000;
-
- /* Don't allow the timeout to be negative */
- if (millis < 0)
- return 0;
-
- /*
- Make sure the calculated timeout does not exceed original timeout
- value which could cause "wait for ever" if system time changes
- */
- if (millis > abstime->max_timeout_msec)
- millis= abstime->max_timeout_msec;
-
- if (millis > UINT_MAX)
- millis= UINT_MAX;
-
- return (DWORD)millis;
+ return INFINITE;
+
+ set_timespec_nsec(current_time, 0);
+ ms= (abstime->tv_sec - current_time.tv_sec)*1000LL +
+ (abstime->tv_nsec - current_time.tv_nsec)/1000000LL;
+ if(ms < 0 )
+ ms= 0;
+ if(ms > UINT_MAX)
+ ms= INFINITE;
+ return (DWORD)ms;
}