diff options
author | Vladislav Vaintroub <wlad@montyprogram.com> | 2011-05-28 16:57:58 +0200 |
---|---|---|
committer | Vladislav Vaintroub <wlad@montyprogram.com> | 2011-05-28 16:57:58 +0200 |
commit | b519f2b626ebd1f3243a21dc883cefa6a26460f9 (patch) | |
tree | faad721ece99fc071000e695861e37d45acda0e5 /storage/pbxt | |
parent | 152dfe58678af35769ca3cd66db592d129b4c08b (diff) | |
download | mariadb-git-b519f2b626ebd1f3243a21dc883cefa6a26460f9.tar.gz |
Fix compile errors and warnings and test errors introduced by microseconds push.
Also, change windows timespec definition to be Unix-ish - simplifies handling a lot.
Diffstat (limited to 'storage/pbxt')
-rw-r--r-- | storage/pbxt/src/filesys_xt.cc | 3 | ||||
-rwxr-xr-x | storage/pbxt/src/pthread_xt.cc | 43 | ||||
-rw-r--r-- | storage/pbxt/src/thread_xt.cc | 16 |
3 files changed, 6 insertions, 56 deletions
diff --git a/storage/pbxt/src/filesys_xt.cc b/storage/pbxt/src/filesys_xt.cc index 31e2cf961b6..ebe0ed146b0 100644 --- a/storage/pbxt/src/filesys_xt.cc +++ b/storage/pbxt/src/filesys_xt.cc @@ -369,8 +369,7 @@ xtPublic xtBool xt_fs_stat(XTThreadPtr self, char *path, off_t *size, struct tim CloseHandle(fh); if (size) *size = (off_t) info.nFileSizeLow | (((off_t) info.nFileSizeHigh) << 32); - if (mod_time) - mod_time->tv.ft = info.ftLastWriteTime; + memset(mod_time, 0, sizeof(*mod_time)); #else struct stat sb; diff --git a/storage/pbxt/src/pthread_xt.cc b/storage/pbxt/src/pthread_xt.cc index c5dc2e41fdd..9f35f50b8c7 100755 --- a/storage/pbxt/src/pthread_xt.cc +++ b/storage/pbxt/src/pthread_xt.cc @@ -396,48 +396,7 @@ xtPublic int xt_p_cond_wait(xt_cond_type *cond, xt_mutex_type *mutex) xtPublic int xt_p_cond_timedwait(xt_cond_type *cond, xt_mutex_type *mt, struct timespec *abstime) { - pthread_mutex_t *mutex = &mt->mt_cs; - int result; - long timeout; - union ft64 now; - - if (abstime != NULL) { - GetSystemTimeAsFileTime(&now.ft); - - timeout = (long)((abstime->tv.i64 - now.i64) / 10000); - if (timeout < 0) - timeout = 0L; - if (timeout > abstime->max_timeout_msec) - timeout = abstime->max_timeout_msec; - } - else - timeout= INFINITE; - - WaitForSingleObject(cond->broadcast_block_event, INFINITE); - - EnterCriticalSection(&cond->lock_waiting); - cond->waiting++; - LeaveCriticalSection(&cond->lock_waiting); - - LeaveCriticalSection(mutex); - - result= WaitForMultipleObjects(2, cond->events, FALSE, timeout); - - EnterCriticalSection(&cond->lock_waiting); - cond->waiting--; - - if (cond->waiting == 0) { - /* The last waiter must reset the broadcast - * state (whther there was a broadcast or not)! - */ - ResetEvent(cond->events[xt_cond_type::BROADCAST]); - SetEvent(cond->broadcast_block_event); - } - LeaveCriticalSection(&cond->lock_waiting); - - EnterCriticalSection(mutex); - - return result == WAIT_TIMEOUT ? ETIMEDOUT : 0; + return pthread_cond_timedwait(cond, &mt->mt_cs, abstime); } xtPublic int xt_p_join(pthread_t thread, void **value) diff --git a/storage/pbxt/src/thread_xt.cc b/storage/pbxt/src/thread_xt.cc index 52c2c6c29c5..eb9941f13fb 100644 --- a/storage/pbxt/src/thread_xt.cc +++ b/storage/pbxt/src/thread_xt.cc @@ -54,6 +54,9 @@ void xt_db_exit_thread(XTThreadPtr self); static void thr_accumulate_statistics(XTThreadPtr self); +#ifdef _WIN32 +#include <my_sys.h> +#endif /* * ----------------------------------------------------------------------- * THREAD GLOBALS @@ -1962,18 +1965,7 @@ xtPublic xtBool xt_timed_wait_cond(XTThreadPtr self, xt_cond_type *cond, xt_mute XTThreadPtr me = self ? self : xt_get_self(); #ifdef XT_WIN - union ft64 now; - - GetSystemTimeAsFileTime(&now.ft); - - /* System time is measured in 100ns units. - * This calculation will be reversed by the Windows implementation - * of pthread_cond_timedwait(), in order to extract the - * milli-second timeout! - */ - abstime.tv.i64 = now.i64 + (milli_sec * 10000); - - abstime.max_timeout_msec = milli_sec; + set_timespec_nsec(abstime, 1000000ULL* milli_sec); #else struct timeval now; u_llong micro_sec; |