summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcarlos <caiosignor@gmail.com>2020-04-17 16:02:53 -0300
committerJoão Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>2020-04-29 12:13:38 -0300
commit4e346e2c06c26928420dcf0deb077b01d84839cb (patch)
treec25fd8d8ad7c22402232e95aa1a37d2acc5897c7
parent9577601d06c60144761cc2488eb60e46b8d71056 (diff)
eina_sched_posix code convention
-rw-r--r--src/lib/eina/eina_sched_posix.c75
1 files changed, 37 insertions, 38 deletions
diff --git a/src/lib/eina/eina_sched_posix.c b/src/lib/eina/eina_sched_posix.c
index 89c8428e7d..6353c9917f 100644
--- a/src/lib/eina/eina_sched_posix.c
+++ b/src/lib/eina/eina_sched_posix.c
@@ -25,46 +25,45 @@
25 25
26EAPI void eina_sched_prio_drop(void) 26EAPI void eina_sched_prio_drop(void)
27{ 27{
28 struct sched_param param; 28 struct sched_param param;
29 int pol, ret; 29 int pol, ret;
30 Eina_Thread pthread_id; 30 Eina_Thread pthread_id;
31 31
32 pthread_id = eina_thread_self(); 32 pthread_id = eina_thread_self();
33 ret = pthread_getschedparam(pthread_id, &pol, &param); 33 ret = pthread_getschedparam(pthread_id, &pol, &param);
34 if (ret) 34 if (ret)
35 { 35 {
36 EINA_LOG_ERR("Unable to query sched parameters"); 36 EINA_LOG_ERR("Unable to query sched parameters");
37 return; 37 return;
38 } 38 }
39 39
40 if (EINA_UNLIKELY(pol == SCHED_RR || pol == SCHED_FIFO)) 40 if (EINA_UNLIKELY(pol == SCHED_RR || pol == SCHED_FIFO))
41 { 41 {
42 param.sched_priority -= RTNICENESS; 42 param.sched_priority -= RTNICENESS;
43 43
44 /* We don't change the policy */ 44 /* We don't change the policy */
45 if (param.sched_priority < 1) 45 if (param.sched_priority < 1)
46 { 46 {
47 EINA_LOG_INFO("RT prio < 1, setting to 1 instead"); 47 EINA_LOG_INFO("RT prio < 1, setting to 1 instead");
48 param.sched_priority = 1; 48 param.sched_priority = 1;
49 } 49 }
50 50
51 pthread_setschedparam(pthread_id, pol, &param); 51 pthread_setschedparam(pthread_id, pol, &param);
52 } 52 }
53 else 53 else
54 { 54 {
55 int prio; 55 int prio;
56 errno = 0; 56 errno = 0;
57 prio = getpriority(PRIO_PROCESS, 0); 57 prio = getpriority(PRIO_PROCESS, 0);
58 if (errno == 0) 58 if (errno == 0)
59 { 59 {
60 prio += NICENESS; 60 prio += NICENESS;
61 if (prio > 19) 61 if (prio > 19)
62 { 62 {
63 EINA_LOG_INFO("Max niceness reached; keeping max (19)"); 63 EINA_LOG_INFO("Max niceness reached; keeping max (19)");
64 prio = 19; 64 prio = 19;
65 } 65 }
66 66 setpriority(PRIO_PROCESS, 0, prio);
67 setpriority(PRIO_PROCESS, 0, prio); 67 }
68 } 68 }
69 }
70} \ No newline at end of file 69} \ No newline at end of file