Skip to content

Commit

Permalink
realtime: fix set priority Class in Windows support (AravisProject#594)
Browse files Browse the repository at this point in the history
  • Loading branch information
garfeng authored Oct 25, 2021
1 parent 380ad0c commit 5adfdc3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/arvrealtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ arv_make_thread_high_priority (int nice_level)
gboolean
arv_make_thread_realtime (int priority)
{
if(!SetPriorityClass(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL))
SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
if(!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL))
{
DWORD err = GetLastError();
arv_warning_misc ("SetPriorityClass(..., THREAD_PRIORITY_TIME_CRITICAL) failed (%lu)", err);
Expand All @@ -342,10 +343,10 @@ arv_make_thread_realtime (int priority)
gboolean
arv_make_thread_high_priority (int priority)
{
if(!SetPriorityClass(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL))
if(!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST))
{
DWORD err = GetLastError();
arv_warning_misc ("SetPriorityClass(..., THREAD_PRIORITY_ABOVE_NORMAL) failed (%lu)", err);
arv_warning_misc ("SetPriorityClass(..., THREAD_PRIORITY_HIGHEST) failed (%lu)", err);
return FALSE;
}
g_critical("Thread made high-priority!");
Expand Down

0 comments on commit 5adfdc3

Please sign in to comment.