Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
6d2d3595
Commit
6d2d3595
authored
Apr 06, 2020
by
Piotr Caban
Committed by
Alexandre Julliard
Apr 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Use monotonic clock in waitable timers.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
af89b53c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
10 deletions
+19
-10
sync.c
dlls/ntdll/sync.c
+9
-2
server_protocol.h
include/wine/server_protocol.h
+1
-1
protocol.def
server/protocol.def
+1
-1
timer.c
server/timer.c
+8
-6
No files found.
dlls/ntdll/sync.c
View file @
6d2d3595
...
...
@@ -1025,8 +1025,15 @@ NTSTATUS WINAPI NtQueryTimer(
}
SERVER_END_REQ
;
/* convert from absolute into relative time */
NtQuerySystemTime
(
&
now
);
/* convert into relative time */
if
(
basic_info
->
RemainingTime
.
QuadPart
>
0
)
NtQuerySystemTime
(
&
now
);
else
{
RtlQueryPerformanceCounter
(
&
now
);
basic_info
->
RemainingTime
.
QuadPart
=
-
basic_info
->
RemainingTime
.
QuadPart
;
}
if
(
now
.
QuadPart
>
basic_info
->
RemainingTime
.
QuadPart
)
basic_info
->
RemainingTime
.
QuadPart
=
0
;
else
...
...
include/wine/server_protocol.h
View file @
6d2d3595
...
...
@@ -471,7 +471,7 @@ typedef union
enum
apc_type
type
;
int
__pad
;
client_ptr_t
func
;
timeout
_t
time
;
abstime
_t
time
;
client_ptr_t
arg
;
}
timer
;
struct
...
...
server/protocol.def
View file @
6d2d3595
...
...
@@ -487,7 +487,7 @@ typedef union
enum apc_type type; /* APC_TIMER */
int __pad;
client_ptr_t func; /* void (__stdcall *func)(void*, unsigned int, unsigned int); */
timeout_t time; /* absolute
time of expiration */
abstime_t time; /*
time of expiration */
client_ptr_t arg; /* user argument */
} timer;
struct
...
...
server/timer.c
View file @
6d2d3595
...
...
@@ -43,7 +43,7 @@ struct timer
int
manual
;
/* manual reset */
int
signaled
;
/* current signaled state */
unsigned
int
period
;
/* timer period in ms */
timeout
_t
when
;
/* next expiration */
abstime
_t
when
;
/* next expiration */
struct
timeout_user
*
timeout
;
/* timeout user */
struct
thread
*
thread
;
/* thread that set the APC function */
client_ptr_t
callback
;
/* callback APC function */
...
...
@@ -132,8 +132,9 @@ static void timer_callback( void *private )
if
(
timer
->
period
)
/* schedule the next expiration */
{
timer
->
when
+=
(
timeout_t
)
timer
->
period
*
10000
;
timer
->
timeout
=
add_timeout_user
(
timer
->
when
,
timer_callback
,
timer
);
if
(
timer
->
when
>
0
)
timer
->
when
=
-
monotonic_time
;
timer
->
when
-=
(
abstime_t
)
timer
->
period
*
10000
;
timer
->
timeout
=
add_timeout_user
(
abstime_to_timeout
(
timer
->
when
),
timer_callback
,
timer
);
}
else
timer
->
timeout
=
NULL
;
...
...
@@ -171,21 +172,22 @@ static int set_timer( struct timer *timer, timeout_t expire, unsigned int period
period
=
0
;
/* period doesn't make any sense for a manual timer */
timer
->
signaled
=
0
;
}
timer
->
when
=
(
expire
<=
0
)
?
current_time
-
expir
e
:
max
(
expire
,
current_time
);
timer
->
when
=
(
expire
<=
0
)
?
expire
-
monotonic_tim
e
:
max
(
expire
,
current_time
);
timer
->
period
=
period
;
timer
->
callback
=
callback
;
timer
->
arg
=
arg
;
if
(
callback
)
timer
->
thread
=
(
struct
thread
*
)
grab_object
(
current
);
timer
->
timeout
=
add_timeout_user
(
timer
->
when
,
timer_callback
,
timer
);
timer
->
timeout
=
add_timeout_user
(
expire
,
timer_callback
,
timer
);
return
signaled
;
}
static
void
timer_dump
(
struct
object
*
obj
,
int
verbose
)
{
struct
timer
*
timer
=
(
struct
timer
*
)
obj
;
timeout_t
timeout
=
abstime_to_timeout
(
timer
->
when
);
assert
(
obj
->
ops
==
&
timer_ops
);
fprintf
(
stderr
,
"Timer manual=%d when=%s period=%u
\n
"
,
timer
->
manual
,
get_timeout_str
(
time
r
->
when
),
timer
->
period
);
timer
->
manual
,
get_timeout_str
(
time
out
),
timer
->
period
);
}
static
struct
object_type
*
timer_get_type
(
struct
object
*
obj
)
...
...
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