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
ba5a6436
Commit
ba5a6436
authored
Mar 14, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Mar 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quartz/systemclock: Clarify some field names.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b5eff130
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
35 deletions
+35
-35
systemclock.c
dlls/quartz/systemclock.c
+35
-35
No files found.
dlls/quartz/systemclock.c
View file @
ba5a6436
...
...
@@ -29,8 +29,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz);
struct
advise_sink
{
struct
list
entry
;
HANDLE
h
Event
;
REFERENCE_TIME
rtBaseTime
,
rtIntervalTime
;
HANDLE
h
andle
;
REFERENCE_TIME
due_time
,
period
;
};
typedef
struct
SystemClockImpl
{
...
...
@@ -40,7 +40,7 @@ typedef struct SystemClockImpl {
BOOL
thread_created
;
HANDLE
thread
,
notify_event
,
stop_event
;
REFERENCE_TIME
last_time
;
CRITICAL_SECTION
safe
;
CRITICAL_SECTION
cs
;
/* These lists are ordered by expiration time (soonest first). */
struct
list
single_sinks
,
periodic_sinks
;
...
...
@@ -53,12 +53,12 @@ static inline SystemClockImpl *impl_from_IReferenceClock(IReferenceClock *iface)
static
void
insert_advise_sink
(
struct
advise_sink
*
sink
,
struct
list
*
queue
)
{
REFERENCE_TIME
due_time
=
sink
->
rtBaseTime
+
sink
->
rtIntervalTime
;
REFERENCE_TIME
due_time
=
sink
->
due_time
+
sink
->
period
;
struct
advise_sink
*
cursor
;
LIST_FOR_EACH_ENTRY
(
cursor
,
queue
,
struct
advise_sink
,
entry
)
{
if
(
cursor
->
rtBaseTime
+
cursor
->
rtIntervalTime
>
due_time
)
if
(
cursor
->
due_time
+
cursor
->
period
>
due_time
)
{
list_add_before
(
&
cursor
->
entry
,
&
sink
->
entry
);
return
;
...
...
@@ -79,17 +79,17 @@ static DWORD WINAPI SystemClockAdviseThread(LPVOID lpParam) {
TRACE
(
"(%p): Main Loop
\n
"
,
This
);
while
(
TRUE
)
{
EnterCriticalSection
(
&
This
->
safe
);
EnterCriticalSection
(
&
This
->
cs
);
curTime
=
GetTickCount64
()
*
10000
;
/** First SingleShots Advice: sorted list */
LIST_FOR_EACH_ENTRY_SAFE
(
sink
,
cursor
,
&
This
->
single_sinks
,
struct
advise_sink
,
entry
)
{
if
(
sink
->
rtBaseTime
+
sink
->
rtIntervalTime
>
curTime
)
if
(
sink
->
due_time
+
sink
->
period
>
curTime
)
break
;
SetEvent
(
sink
->
h
Event
);
SetEvent
(
sink
->
h
andle
);
list_remove
(
&
sink
->
entry
);
heap_free
(
sink
);
}
...
...
@@ -97,23 +97,23 @@ static DWORD WINAPI SystemClockAdviseThread(LPVOID lpParam) {
if
((
entry
=
list_head
(
&
This
->
single_sinks
)))
{
sink
=
LIST_ENTRY
(
entry
,
struct
advise_sink
,
entry
);
timeOut
=
(
sink
->
rtBaseTime
+
sink
->
rtIntervalTime
-
curTime
)
/
10000
;
timeOut
=
(
sink
->
due_time
+
sink
->
period
-
curTime
)
/
10000
;
}
else
timeOut
=
INFINITE
;
/** Now Periodics Advice: semi sorted list (sort cannot be used) */
LIST_FOR_EACH_ENTRY
(
sink
,
&
This
->
periodic_sinks
,
struct
advise_sink
,
entry
)
{
if
(
sink
->
rtBaseT
ime
<=
curTime
)
if
(
sink
->
due_t
ime
<=
curTime
)
{
DWORD
periods
=
((
curTime
-
sink
->
rtBaseTime
)
/
sink
->
rtIntervalTime
)
+
1
;
ReleaseSemaphore
(
sink
->
h
Event
,
periods
,
NULL
);
sink
->
rtBaseTime
+=
periods
*
sink
->
rtIntervalTime
;
DWORD
periods
=
((
curTime
-
sink
->
due_time
)
/
sink
->
period
)
+
1
;
ReleaseSemaphore
(
sink
->
h
andle
,
periods
,
NULL
);
sink
->
due_time
+=
periods
*
sink
->
period
;
}
timeOut
=
min
(
timeOut
,
(
sink
->
rtBaseT
ime
-
curTime
)
/
10000
);
timeOut
=
min
(
timeOut
,
(
sink
->
due_t
ime
-
curTime
)
/
10000
);
}
LeaveCriticalSection
(
&
This
->
safe
);
LeaveCriticalSection
(
&
This
->
cs
);
if
(
WaitForMultipleObjects
(
2
,
handles
,
FALSE
,
timeOut
)
==
0
)
return
0
;
...
...
@@ -173,8 +173,8 @@ static ULONG WINAPI SystemClockImpl_Release(IReferenceClock *iface)
CloseHandle
(
clock
->
notify_event
);
CloseHandle
(
clock
->
stop_event
);
}
clock
->
safe
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
clock
->
safe
);
clock
->
cs
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
clock
->
cs
);
heap_free
(
clock
);
}
return
refcount
;
...
...
@@ -194,12 +194,12 @@ static HRESULT WINAPI SystemClockImpl_GetTime(IReferenceClock *iface, REFERENCE_
ret
=
GetTickCount64
()
*
10000
;
EnterCriticalSection
(
&
clock
->
safe
);
EnterCriticalSection
(
&
clock
->
cs
);
hr
=
(
ret
==
clock
->
last_time
)
?
S_FALSE
:
S_OK
;
*
time
=
clock
->
last_time
=
ret
;
LeaveCriticalSection
(
&
clock
->
safe
);
LeaveCriticalSection
(
&
clock
->
cs
);
return
hr
;
}
...
...
@@ -225,13 +225,13 @@ static HRESULT WINAPI SystemClockImpl_AdviseTime(IReferenceClock *iface,
if
(
!
(
sink
=
heap_alloc_zero
(
sizeof
(
*
sink
))))
return
E_OUTOFMEMORY
;
sink
->
h
Event
=
(
HANDLE
)
event
;
sink
->
rtBaseT
ime
=
base
+
offset
;
sink
->
rtIntervalTime
=
0
;
sink
->
h
andle
=
(
HANDLE
)
event
;
sink
->
due_t
ime
=
base
+
offset
;
sink
->
period
=
0
;
EnterCriticalSection
(
&
clock
->
safe
);
EnterCriticalSection
(
&
clock
->
cs
);
insert_advise_sink
(
sink
,
&
clock
->
single_sinks
);
LeaveCriticalSection
(
&
clock
->
safe
);
LeaveCriticalSection
(
&
clock
->
cs
);
notify_thread
(
clock
);
...
...
@@ -260,13 +260,13 @@ static HRESULT WINAPI SystemClockImpl_AdvisePeriodic(IReferenceClock* iface,
if
(
!
(
sink
=
heap_alloc_zero
(
sizeof
(
*
sink
))))
return
E_OUTOFMEMORY
;
sink
->
h
Event
=
(
HANDLE
)
semaphore
;
sink
->
rtBaseT
ime
=
start
;
sink
->
rtIntervalTime
=
period
;
sink
->
h
andle
=
(
HANDLE
)
semaphore
;
sink
->
due_t
ime
=
start
;
sink
->
period
=
period
;
EnterCriticalSection
(
&
clock
->
safe
);
EnterCriticalSection
(
&
clock
->
cs
);
insert_advise_sink
(
sink
,
&
clock
->
periodic_sinks
);
LeaveCriticalSection
(
&
clock
->
safe
);
LeaveCriticalSection
(
&
clock
->
cs
);
notify_thread
(
clock
);
...
...
@@ -281,7 +281,7 @@ static HRESULT WINAPI SystemClockImpl_Unadvise(IReferenceClock *iface, DWORD_PTR
TRACE
(
"clock %p, cookie %#lx.
\n
"
,
clock
,
cookie
);
EnterCriticalSection
(
&
clock
->
safe
);
EnterCriticalSection
(
&
clock
->
cs
);
LIST_FOR_EACH_ENTRY
(
sink
,
&
clock
->
single_sinks
,
struct
advise_sink
,
entry
)
{
...
...
@@ -289,7 +289,7 @@ static HRESULT WINAPI SystemClockImpl_Unadvise(IReferenceClock *iface, DWORD_PTR
{
list_remove
(
&
sink
->
entry
);
heap_free
(
sink
);
LeaveCriticalSection
(
&
clock
->
safe
);
LeaveCriticalSection
(
&
clock
->
cs
);
return
S_OK
;
}
}
...
...
@@ -300,12 +300,12 @@ static HRESULT WINAPI SystemClockImpl_Unadvise(IReferenceClock *iface, DWORD_PTR
{
list_remove
(
&
sink
->
entry
);
heap_free
(
sink
);
LeaveCriticalSection
(
&
clock
->
safe
);
LeaveCriticalSection
(
&
clock
->
cs
);
return
S_OK
;
}
}
LeaveCriticalSection
(
&
clock
->
safe
);
LeaveCriticalSection
(
&
clock
->
cs
);
return
S_FALSE
;
}
...
...
@@ -336,8 +336,8 @@ HRESULT QUARTZ_CreateSystemClock(IUnknown *outer, void **out)
object
->
IReferenceClock_iface
.
lpVtbl
=
&
SystemClock_Vtbl
;
list_init
(
&
object
->
single_sinks
);
list_init
(
&
object
->
periodic_sinks
);
InitializeCriticalSection
(
&
object
->
safe
);
object
->
safe
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": SystemClockImpl.safe
"
);
InitializeCriticalSection
(
&
object
->
cs
);
object
->
cs
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": SystemClockImpl.cs
"
);
return
SystemClockImpl_QueryInterface
(
&
object
->
IReferenceClock_iface
,
&
IID_IReferenceClock
,
out
);
}
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