Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
videolan
vlc-2-2
Commits
a5e6bc39
Commit
a5e6bc39
authored
Sep 06, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32: run-time support for Seven's interrupt time
parent
0db5d1d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
12 deletions
+32
-12
src/win32/thread.c
src/win32/thread.c
+32
-12
No files found.
src/win32/thread.c
View file @
a5e6bc39
...
@@ -721,29 +721,39 @@ static union
...
@@ -721,29 +721,39 @@ static union
{
{
struct
struct
{
{
LARGE_INTEGER
freq
;
#if (_WIN32_WINNT < 0x0601)
}
perf
;
BOOL
(
*
query
)
(
PULONGLONG
);
#endif
}
interrupt
;
struct
struct
{
{
#if (_WIN32_WINNT < 0x0600)
#if (_WIN32_WINNT < 0x0600)
ULONGLONG
(
*
get
)
(
void
);
ULONGLONG
(
*
get
)
(
void
);
#endif
#endif
}
tick
;
}
tick
;
struct
{
LARGE_INTEGER
freq
;
}
perf
;
}
clk
;
}
clk
;
#if (_WIN32_WINNT >= 0x0601)
static
mtime_t
mdate_interrupt
(
void
)
static
mtime_t
mdate_interrupt
(
void
)
{
{
ULONGLONG
ts
;
ULONGLONG
ts
;
BOOL
ret
;
if
(
unlikely
(
!
QueryUnbiasedInterruptTime
(
&
ts
)))
#if (_WIN32_WINNT >= 0x0601)
ret
=
QueryUnbiasedInterruptTime
(
&
ts
);
#else
ret
=
clk
.
interrupt
.
query
(
&
ts
);
#endif
if
(
unlikely
(
!
ret
))
abort
();
abort
();
/* hundreds of nanoseconds */
/* hundreds of nanoseconds */
static_assert
((
10000000
%
CLOCK_FREQ
)
==
0
,
"Broken frequencies ratio"
);
static_assert
((
10000000
%
CLOCK_FREQ
)
==
0
,
"Broken frequencies ratio"
);
return
ts
/
(
10000000
/
CLOCK_FREQ
);
return
ts
/
(
10000000
/
CLOCK_FREQ
);
}
}
#endif
static
mtime_t
mdate_tick
(
void
)
static
mtime_t
mdate_tick
(
void
)
{
{
...
@@ -833,14 +843,21 @@ void SelectClockSource (vlc_object_t *obj)
...
@@ -833,14 +843,21 @@ void SelectClockSource (vlc_object_t *obj)
char
*
str
=
var_InheritString
(
obj
,
"clock-source"
);
char
*
str
=
var_InheritString
(
obj
,
"clock-source"
);
if
(
str
!=
NULL
)
if
(
str
!=
NULL
)
name
=
str
;
name
=
str
;
#if (_WIN32_WINNT >= 0x0601)
if
(
!
strcmp
(
name
,
"interrupt"
))
if
(
!
strcmp
(
name
,
"interrupt"
))
{
{
msg_Dbg
(
obj
,
"using interrupt time as clock source"
);
msg_Dbg
(
obj
,
"using interrupt time as clock source"
);
#if (_WIN32_WINNT < 0x0601)
HANDLE
h
=
GetModuleHandle
(
_T
(
"kernel32.dll"
));
if
(
unlikely
(
h
==
NULL
))
abort
();
clk
.
interrupt
.
query
=
(
void
*
)
GetProcAddress
(
h
,
_T
(
"QueryUnbiasedInterruptTime"
));
if
(
unlikely
(
clk
.
interrupt
.
query
==
NULL
))
abort
();
#endif
mdate_selected
=
mdate_interrupt
;
mdate_selected
=
mdate_interrupt
;
}
}
else
else
#endif
if
(
!
strcmp
(
name
,
"tick"
))
if
(
!
strcmp
(
name
,
"tick"
))
{
{
msg_Dbg
(
obj
,
"using Windows time as clock source"
);
msg_Dbg
(
obj
,
"using Windows time as clock source"
);
...
@@ -899,7 +916,7 @@ size_t EnumClockSource (vlc_object_t *obj, char ***vp, char ***np)
...
@@ -899,7 +916,7 @@ size_t EnumClockSource (vlc_object_t *obj, char ***vp, char ***np)
char
**
names
=
xmalloc
(
sizeof
(
*
names
)
*
max
);
char
**
names
=
xmalloc
(
sizeof
(
*
names
)
*
max
);
size_t
n
=
0
;
size_t
n
=
0
;
#if (_WIN32_WINNT < 0x060
0
)
#if (_WIN32_WINNT < 0x060
1
)
DWORD
version
=
LOWORD
(
GetVersion
());
DWORD
version
=
LOWORD
(
GetVersion
());
version
=
(
LOBYTE
(
version
)
<<
8
)
|
(
HIBYTE
(
version
)
<<
0
);
version
=
(
LOBYTE
(
version
)
<<
8
)
|
(
HIBYTE
(
version
)
<<
0
);
#endif
#endif
...
@@ -907,11 +924,14 @@ size_t EnumClockSource (vlc_object_t *obj, char ***vp, char ***np)
...
@@ -907,11 +924,14 @@ size_t EnumClockSource (vlc_object_t *obj, char ***vp, char ***np)
values
[
n
]
=
xstrdup
(
""
);
values
[
n
]
=
xstrdup
(
""
);
names
[
n
]
=
xstrdup
(
_
(
"Auto"
));
names
[
n
]
=
xstrdup
(
_
(
"Auto"
));
n
++
;
n
++
;
#if (_WIN32_WINNT >= 0x0601)
#if (_WIN32_WINNT < 0x0601)
values
[
n
]
=
xstrdup
(
"interrupt"
);
if
(
version
>=
0x0601
)
names
[
n
]
=
xstrdup
(
"Interrupt time"
);
n
++
;
#endif
#endif
{
values
[
n
]
=
xstrdup
(
"interrupt"
);
names
[
n
]
=
xstrdup
(
"Interrupt time"
);
n
++
;
}
#if (_WIN32_WINNT < 0x0600)
#if (_WIN32_WINNT < 0x0600)
if
(
version
>=
0x0600
)
if
(
version
>=
0x0600
)
#endif
#endif
...
...
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