Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
e5710dee
Commit
e5710dee
authored
Dec 18, 2006
by
msvensson@shellback
Browse files
Options
Browse Files
Download
Plain Diff
Merge maint1:/data/localhome/msvensson/mysql-5.0-maint
into shellback.:C:/mysql/mysql-5.0-maint
parents
6cd4a816
c3fb91b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
15 deletions
+18
-15
include/my_pthread.h
include/my_pthread.h
+8
-6
mysys/my_wincond.c
mysys/my_wincond.c
+10
-9
No files found.
include/my_pthread.h
View file @
e5710dee
...
@@ -94,17 +94,19 @@ typedef void * (__cdecl *pthread_handler)(void *);
...
@@ -94,17 +94,19 @@ 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); \
}
}
void
win_pthread_init
(
void
);
void
win_pthread_init
(
void
);
...
...
mysys/my_wincond.c
View file @
e5710dee
...
@@ -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 time
out
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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment