summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcarlos <caiosignor@gmail.com>2020-04-17 16:08:49 -0300
committerJoão Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>2020-04-29 12:13:38 -0300
commit39adc0b580d434ecd1001ea72e3ad66f3df98523 (patch)
tree23efad6f6de3b9980df96e58b7c8923fd32f6c4a
parent4e346e2c06c26928420dcf0deb077b01d84839cb (diff)
eina_sched_win32 code convention
-rw-r--r--src/lib/eina/eina_sched_win32.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/src/lib/eina/eina_sched_win32.c b/src/lib/eina/eina_sched_win32.c
index eaacdda0fd..da2a84daae 100644
--- a/src/lib/eina/eina_sched_win32.c
+++ b/src/lib/eina/eina_sched_win32.c
@@ -21,6 +21,7 @@
21# define WIN32_LEAN_AND_MEAN 21# define WIN32_LEAN_AND_MEAN
22#endif 22#endif
23#include <Windows.h> 23#include <Windows.h>
24#undef WIN32_LEAN_AND_MEAN
24 25
25EAPI void eina_sched_prio_drop(void) 26EAPI void eina_sched_prio_drop(void)
26{ 27{
@@ -32,33 +33,33 @@ EAPI void eina_sched_prio_drop(void)
32 sched_priority = GetThreadPriority((HANDLE)pthread_id); 33 sched_priority = GetThreadPriority((HANDLE)pthread_id);
33 34
34 if (EINA_UNLIKELY(sched_priority == THREAD_PRIORITY_TIME_CRITICAL)) 35 if (EINA_UNLIKELY(sched_priority == THREAD_PRIORITY_TIME_CRITICAL))
35 { 36 {
36 sched_priority -= RTNICENESS; 37 sched_priority -= RTNICENESS;
37 38
38 /* We don't change the policy */ 39 /* We don't change the policy */
39 if (sched_priority < 1) 40 if (sched_priority < 1)
40 { 41 {
41 EINA_LOG_INFO("RT prio < 1, setting to 1 instead"); 42 EINA_LOG_INFO("RT prio < 1, setting to 1 instead");
42 sched_priority = 1; 43 sched_priority = 1;
43 } 44 }
44 if (!SetThreadPriority((HANDLE)pthread_id, sched_priority)) 45 if (!SetThreadPriority((HANDLE)pthread_id, sched_priority))
45 { 46 {
46 EINA_LOG_ERR("Unable to query sched parameters"); 47 EINA_LOG_ERR("Unable to query sched parameters");
47 } 48 }
48 } 49 }
49 else 50 else
50 { 51 {
51 sched_priority += NICENESS; 52 sched_priority += NICENESS;
52 53
53 /* We don't change the policy */ 54 /* We don't change the policy */
54 if (sched_priority > THREAD_PRIORITY_TIME_CRITICAL) 55 if (sched_priority > THREAD_PRIORITY_TIME_CRITICAL)
55 { 56 {
56 EINA_LOG_INFO("Max niceness reached; keeping max (THREAD_PRIORITY_TIME_CRITICAL)"); 57 EINA_LOG_INFO("Max niceness reached; keeping max (THREAD_PRIORITY_TIME_CRITICAL)");
57 sched_priority = THREAD_PRIORITY_TIME_CRITICAL; 58 sched_priority = THREAD_PRIORITY_TIME_CRITICAL;
58 } 59 }
59 if (!SetThreadPriority((HANDLE)pthread_id, sched_priority)) 60 if (!SetThreadPriority((HANDLE)pthread_id, sched_priority))
60 { 61 {
61 EINA_LOG_ERR("Unable to query sched parameters"); 62 EINA_LOG_ERR("Unable to query sched parameters");
62 } 63 }
63 } 64 }
64} 65}