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
419e9281
Commit
419e9281
authored
Apr 23, 2005
by
Robert Reif
Committed by
Alexandre Julliard
Apr 23, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set thread priority for timer thread.
Add timer thread priority test.
parent
025bc2d8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
0 deletions
+57
-0
timer.c
dlls/winmm/tests/timer.c
+56
-0
time.c
dlls/winmm/time.c
+1
-0
No files found.
dlls/winmm/tests/timer.c
View file @
419e9281
...
...
@@ -142,6 +142,60 @@ static void test_timer(UINT period, UINT resolution)
dwMin
,
dwMax
,
sum
/
(
count
-
1
),
sqrt
(
deviation
/
(
count
-
2
)));
}
const
char
*
get_priority
(
int
priority
)
{
static
char
tmp
[
32
];
#define STR(x) case x: return #x
switch
(
priority
)
{
STR
(
THREAD_PRIORITY_LOWEST
);
STR
(
THREAD_PRIORITY_BELOW_NORMAL
);
STR
(
THREAD_PRIORITY_NORMAL
);
STR
(
THREAD_PRIORITY_HIGHEST
);
STR
(
THREAD_PRIORITY_ABOVE_NORMAL
);
STR
(
THREAD_PRIORITY_TIME_CRITICAL
);
STR
(
THREAD_PRIORITY_IDLE
);
}
sprintf
(
tmp
,
"UNKNOWN(%d)"
,
priority
);
return
tmp
;
}
static
int
priority
=
0
;
static
BOOL
disable_boost
=
FALSE
;
static
BOOL
fired
=
FALSE
;
void
CALLBACK
priorityTimeProc
(
UINT
uID
,
UINT
uMsg
,
DWORD
dwUser
,
DWORD
dw1
,
DWORD
dw2
)
{
BOOL
res
;
priority
=
GetThreadPriority
(
GetCurrentThread
());
res
=
GetThreadPriorityBoost
(
GetCurrentThread
(),
&
disable_boost
);
ok
(
res
==
0
,
"GetThreadPriorityBoost() failed, GetLastError() = %08lx
\n
"
,
GetLastError
());
fired
=
TRUE
;
}
void
test_priority
()
{
UINT
id
;
fired
=
FALSE
;
id
=
timeSetEvent
(
100
,
100
,
priorityTimeProc
,
0
,
TIME_ONESHOT
);
ok
(
id
!=
0
,
"timeSetEvent(100, 100, %p, 0, TIME_ONESHOT) returned %d, "
"should have returned id > 0
\n
"
,
priorityTimeProc
,
id
);
if
(
id
==
0
)
return
;
Sleep
(
200
);
ok
(
fired
==
TRUE
,
"Callback not called
\n
"
);
if
(
fired
)
{
ok
(
priority
==
THREAD_PRIORITY_TIME_CRITICAL
,
"thread priority is %s, should be THREAD_PRIORITY_TIME_CRITICAL
\n
"
,
get_priority
(
priority
));
ok
(
disable_boost
==
FALSE
,
"disable thread boost should be FALSE
\n
"
);
}
}
START_TEST
(
timer
)
{
test_timeGetDevCaps
();
...
...
@@ -163,4 +217,6 @@ START_TEST(timer)
test_timer
(
20
,
10
);
test_timer
(
20
,
20
);
}
test_priority
();
}
dlls/winmm/time.c
View file @
419e9281
...
...
@@ -265,6 +265,7 @@ void TIME_MMTimeStart(void)
TIME_hWakeEvent
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
TIME_TimeToDie
=
FALSE
;
TIME_hMMTimer
=
CreateThread
(
NULL
,
0
,
TIME_MMSysTimeThread
,
WINMM_IData
,
0
,
NULL
);
SetThreadPriority
(
TIME_hMMTimer
,
THREAD_PRIORITY_TIME_CRITICAL
);
}
}
...
...
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