Commit c4c6ab23 authored by unknown's avatar unknown

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
parents 9121fa50 e403f0e7
...@@ -76,19 +76,20 @@ typedef void * (__cdecl *pthread_handler)(void *); ...@@ -76,19 +76,20 @@ typedef void * (__cdecl *pthread_handler)(void *);
__int64 i64; __int64 i64;
}; };
struct timespec { struct timespec {
union ft64 start; union ft64 tv;
/* The max timeout value in millisecond for pthread_cond_timedwait */ /* The max timeout value in millisecond for pthread_cond_timedwait */
long timeout_msec; long max_timeout_msec;
}; };
#define set_timespec(ABSTIME,SEC) { \ #define set_timespec(ABSTIME,SEC) { \
GetSystemTimeAsFileTime(&((ABSTIME).start.ft)); \ GetSystemTimeAsFileTime(&((ABSTIME).tv.ft)); \
(ABSTIME).timeout_msec= (long)((SEC)*1000); \ (ABSTIME).tv.i64+= (__int64)(SEC)*10000000; \
(ABSTIME).max_timeout_msec= (long)((SEC)*1000); \
} }
#define set_timespec_nsec(ABSTIME,NSEC) { \ #define set_timespec_nsec(ABSTIME,NSEC) { \
GetSystemTimeAsFileTime(&((ABSTIME).start.ft)); \ GetSystemTimeAsFileTime(&((ABSTIME).tv.ft)); \
(ABSTIME).timeout_msec= (long)((NSEC)/1000000); \ (ABSTIME).tv.i64+= (__int64)(NSEC)/100; \
(ABSTIME).max_timeout_msec= (long)((NSEC)/1000000); \
} }
#define get_timespec_sec(ABSTIME) ((((ABSTIME).start.i64 / 10000) + (ABSTIME).timeout_msec ) / 1000)
void win_pthread_init(void); void win_pthread_init(void);
int win_pthread_setspecific(void *A,void *B,uint length); int win_pthread_setspecific(void *A,void *B,uint length);
...@@ -410,9 +411,6 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex); ...@@ -410,9 +411,6 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
(ABSTIME).ts_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \ (ABSTIME).ts_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
} }
#endif /* !set_timespec_nsec */ #endif /* !set_timespec_nsec */
#ifndef get_timespec_sec
#define get_timespec_sec(ABSTIME) (ABSTIME).ts_sec
#endif /* !get_timespec_sec */
#else #else
#ifndef set_timespec #ifndef set_timespec
#define set_timespec(ABSTIME,SEC) \ #define set_timespec(ABSTIME,SEC) \
...@@ -431,9 +429,6 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex); ...@@ -431,9 +429,6 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
(ABSTIME).tv_nsec= (long) (now % ULL(10000000) * 100 + ((NSEC) % 100)); \ (ABSTIME).tv_nsec= (long) (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
} }
#endif /* !set_timespec_nsec */ #endif /* !set_timespec_nsec */
#ifndef get_timespec_sec
#define get_timespec_sec(ABSTIME) (ABSTIME).tv_sec
#endif /* !get_timespec_sec */
#endif /* HAVE_TIMESPEC_TS_SEC */ #endif /* HAVE_TIMESPEC_TS_SEC */
/* safe_mutex adds checking to mutex for easier debugging */ /* safe_mutex adds checking to mutex for easier debugging */
......
...@@ -115,12 +115,12 @@ show create table t1; ...@@ -115,12 +115,12 @@ show create table t1;
Table Create Table Table Create Table
t1 CREATE TEMPORARY TABLE `t1` ( t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) default NULL `a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/log/'
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TEMPORARY TABLE `t1` ( t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) default NULL `a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/log/'
create table t1 (a int) engine=myisam select 42 a; create table t1 (a int) engine=myisam select 42 a;
select * from t1; select * from t1;
a a
......
...@@ -147,20 +147,20 @@ connect (session2,localhost,root,,); ...@@ -147,20 +147,20 @@ connect (session2,localhost,root,,);
connection session1; connection session1;
disable_query_log; disable_query_log;
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/log" select 9 a; eval create temporary table t1 (a int) engine=myisam data directory="$MYSQLTEST_VARDIR/log" select 9 a;
enable_query_log; enable_query_log;
# If running test suite with a non standard tmp dir, the "show create table" # If running test suite with a non standard tmp dir, the "show create table"
# will print "DATA_DIRECTORY=". Use replace_result to mask it out # will print "DATA_DIRECTORY=". Use replace_result to mask it out
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
show create table t1; show create table t1;
connection session2; connection session2;
disable_query_log; disable_query_log;
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/log" select 99 a; eval create temporary table t1 (a int) engine=myisam data directory="$MYSQLTEST_VARDIR/log" select 99 a;
enable_query_log; enable_query_log;
# If running test suite with a non standard tmp dir, the "show create table" # If running test suite with a non standard tmp dir, the "show create table"
# will print "DATA_DIRECTORY=". Use replace_result to mask it out # will print "DATA_DIRECTORY=". Use replace_result to mask it out
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
show create table t1; show create table t1;
connection default; connection default;
......
...@@ -37,7 +37,7 @@ int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr) ...@@ -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) 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) ...@@ -51,6 +51,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
return 0 ; return 0 ;
} }
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
struct timespec *abstime) struct timespec *abstime)
{ {
...@@ -61,26 +62,26 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, ...@@ -61,26 +62,26 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
GetSystemTimeAsFileTime(&now.ft); 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 - 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 */ /* Don't allow the timeout to be negative */
if (timeout < 0) 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 value which could cause "wait for ever" if system time changes
*/ */
if (timeout > abstime->timeout_msec) if (timeout > abstime->max_timeout_msec)
timeout= abstime->timeout_msec; timeout= abstime->max_timeout_msec;
InterlockedIncrement(&cond->waiting); InterlockedIncrement(&cond->waiting);
LeaveCriticalSection(mutex); LeaveCriticalSection(mutex);
result=WaitForSingleObject(cond->semaphore,timeout); result= WaitForSingleObject(cond->semaphore,timeout);
InterlockedDecrement(&cond->waiting); InterlockedDecrement(&cond->waiting);
EnterCriticalSection(mutex); EnterCriticalSection(mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment