summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcarlos <caiosignor@gmail.com>2020-04-23 15:08:56 -0300
committerJoão Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>2020-04-29 12:13:38 -0300
commit6436feb57c0ccbb6a58446bff742a2b0d8de7876 (patch)
tree80191b5a60de6a96f2c8ad6a9b6034d3544d27e1
parent1b45bef1541858c118c96b6074489695c5023aec (diff)
code style
-rw-r--r--src/lib/eina/eina_debug_cpu.c4
-rw-r--r--src/lib/eina/eina_debug_timer.c74
-rw-r--r--src/lib/eina/eina_inline_thread_win32.x13
-rw-r--r--src/lib/eina/eina_thread.c10
-rw-r--r--src/lib/eina/eina_thread_win32.h1
5 files changed, 47 insertions, 55 deletions
diff --git a/src/lib/eina/eina_debug_cpu.c b/src/lib/eina/eina_debug_cpu.c
index 8edbb79db5..ed8440dd2c 100644
--- a/src/lib/eina/eina_debug_cpu.c
+++ b/src/lib/eina/eina_debug_cpu.c
@@ -126,9 +126,7 @@ _sysmon(void *data EINA_UNUSED, Eina_Thread thr EINA_UNUSED)
126 { 126 {
127 Eina_Thread thread = _eina_debug_thread_active[i].thread; 127 Eina_Thread thread = _eina_debug_thread_active[i].thread;
128 // get the clock for the thread and its cpu time usage 128 // get the clock for the thread and its cpu time usage
129 #ifndef _WIN32 129 pthread_getcpuclockid(thread, &cid);
130 pthread_getcpuclockid(thread, &cid);
131 #endif
132 clock_gettime(cid, &t); 130 clock_gettime(cid, &t);
133 // calculate a long timestamp (64bits) 131 // calculate a long timestamp (64bits)
134 tim1 = (_eina_debug_thread_active[i].clok.tv_sec * 1000000000LL) + 132 tim1 = (_eina_debug_thread_active[i].clok.tv_sec * 1000000000LL) +
diff --git a/src/lib/eina/eina_debug_timer.c b/src/lib/eina/eina_debug_timer.c
index bdb971f8d3..2b3c1d2c74 100644
--- a/src/lib/eina/eina_debug_timer.c
+++ b/src/lib/eina/eina_debug_timer.c
@@ -99,48 +99,46 @@ _monitor(void *_data EINA_UNUSED)
99# endif 99# endif
100 100
101 while (1) 101 while (1)
102 { 102 {
103 int timeout = -1; //in milliseconds 103 int timeout = -1; //in milliseconds
104# ifndef _WIN32 104# ifndef _WIN32
105 pthread_testcancel(); 105 pthread_testcancel();
106# endif 106# endif
107 eina_spinlock_take(&_lock); 107 eina_spinlock_take(&_lock);
108 if (_timers) 108 if (_timers)
109 { 109 {
110 Eina_Debug_Timer *t = eina_list_data_get(_timers); 110 Eina_Debug_Timer *t = eina_list_data_get(_timers);
111 timeout = t->timeout; 111 timeout = t->timeout;
112 } 112 }
113 eina_spinlock_release(&_lock); 113 eina_spinlock_release(&_lock);
114 114 ret = epoll_wait(epfd, events, MAX_EVENTS, timeout);
115 ret = epoll_wait(epfd, events, MAX_EVENTS, timeout);
116# ifndef _WIN32 115# ifndef _WIN32
117 pthread_testcancel(); 116 pthread_testcancel();
118# endif 117# endif
119 118 /* Some timer has been add/removed or we need to exit */
120 /* Some timer has been add/removed or we need to exit */ 119 if (ret)
121 if (ret) 120 {
122 { 121 char c;
123 char c; 122 if (read(pipeToThread[0], &c, 1) != 1) break;
124 if (read(pipeToThread[0], &c, 1) != 1) break; 123 }
125 } 124 else
126 else 125 {
127 { 126 Eina_List *itr, *itr2, *renew = NULL;
128 Eina_List *itr, *itr2, *renew = NULL; 127 Eina_Debug_Timer *t;
129 Eina_Debug_Timer *t; 128 eina_spinlock_take(&_lock);
130 eina_spinlock_take(&_lock); 129 EINA_LIST_FOREACH_SAFE(_timers, itr, itr2, t)
131 EINA_LIST_FOREACH_SAFE(_timers, itr, itr2, t) 130 {
132 { 131 if (itr == _timers || t->rel_time == 0)
133 if (itr == _timers || t->rel_time == 0) 132 {
134 { 133 _timers = eina_list_remove(_timers, t);
135 _timers = eina_list_remove(_timers, t); 134 if (t->cb(t->data)) renew = eina_list_append(renew, t);
136 if (t->cb(t->data)) renew = eina_list_append(renew, t); 135 else free(t);
137 else free(t); 136 }
138 } 137 }
139 } 138 EINA_LIST_FREE(renew, t) _timer_append(t);
140 EINA_LIST_FREE(renew, t) _timer_append(t); 139 eina_spinlock_release(&_lock);
141 eina_spinlock_release(&_lock); 140 }
142 } 141 }
143 }
144#endif 142#endif
145 _thread_runs = EINA_FALSE; 143 _thread_runs = EINA_FALSE;
146 close(pipeToThread[0]); 144 close(pipeToThread[0]);
diff --git a/src/lib/eina/eina_inline_thread_win32.x b/src/lib/eina/eina_inline_thread_win32.x
index 44fa74ac73..60ef9d1f80 100644
--- a/src/lib/eina/eina_inline_thread_win32.x
+++ b/src/lib/eina/eina_inline_thread_win32.x
@@ -147,20 +147,21 @@ _eina_thread_cancel(Eina_Thread thread)
147 return !success; 147 return !success;
148} 148}
149 149
150static inline UNIMPLEMENTED 150UNIMPLEMENTED static inline void
151void _eina_thread_setcanceltype(int type, int *oldtype) 151_eina_thread_setcanceltype(int type, int *oldtype)
152{ 152{
153 #warning _eina_thread_setcanceltype is not implemented. 153 #warning _eina_thread_setcanceltype is not implemented.
154} 154}
155 155
156static inline UNIMPLEMENTED 156UNIMPLEMENTED static inline int
157int _eina_thread_setcancelstate(int type, int *oldtype) 157_eina_thread_setcancelstate(int type, int *oldtype)
158{ 158{
159 #warning _eina_thread_setcancelstate is not implemented. 159 #warning _eina_thread_setcancelstate is not implemented.
160 return 0; 160 return 0;
161} 161}
162static inline UNIMPLEMENTED 162
163void _eina_thread_cancel_checkpoint(void) 163UNIMPLEMENTED static inline void
164_eina_thread_cancel_checkpoint(void)
164{ 165{
165 #warning _eina_thread_cancel_checkpoint is not implemented. 166 #warning _eina_thread_cancel_checkpoint is not implemented.
166} 167}
diff --git a/src/lib/eina/eina_thread.c b/src/lib/eina/eina_thread.c
index 49984b2e33..c1a05ea453 100644
--- a/src/lib/eina/eina_thread.c
+++ b/src/lib/eina/eina_thread.c
@@ -21,9 +21,8 @@
21#endif 21#endif
22 22
23#include <stdlib.h> 23#include <stdlib.h>
24
25#include "eina_config.h" 24#include "eina_config.h"
26#include "eina_lock.h" 25#include "eina_lock.h" //in case of a POSIX build, it will include pthread.h with proper flags
27#include "eina_thread.h" 26#include "eina_thread.h"
28#include "eina_sched.h" 27#include "eina_sched.h"
29#include "eina_cpu.h" 28#include "eina_cpu.h"
@@ -41,10 +40,6 @@
41#endif 40#endif
42# include <string.h> 41# include <string.h>
43 42
44#if defined(EINA_HAVE_PTHREAD_AFFINITY) || defined(EINA_HAVE_PTHREAD_SETNAME)
45# define cpu_set_t cpuset_t
46#endif
47
48EAPI const void *EINA_THREAD_JOIN_CANCELED = EINA_THREAD_CANCELED; 43EAPI const void *EINA_THREAD_JOIN_CANCELED = EINA_THREAD_CANCELED;
49 44
50EAPI Eina_Thread 45EAPI Eina_Thread
@@ -58,7 +53,8 @@ eina_thread_equal(Eina_Thread t1, Eina_Thread t2)
58{ 53{
59 return _eina_thread_equal(t1, t2); 54 return _eina_thread_equal(t1, t2);
60} 55}
61static void *_eina_internal_call(void *context) 56static void *
57_eina_internal_call(void *context)
62{ 58{
63 Eina_Thread_Call *c = context; 59 Eina_Thread_Call *c = context;
64 void *r; 60 void *r;
diff --git a/src/lib/eina/eina_thread_win32.h b/src/lib/eina/eina_thread_win32.h
index 8254be720b..435c90854b 100644
--- a/src/lib/eina/eina_thread_win32.h
+++ b/src/lib/eina/eina_thread_win32.h
@@ -27,7 +27,6 @@
27#include "eina_thread.h" 27#include "eina_thread.h"
28#include "unimplemented.h" 28#include "unimplemented.h"
29#include <errno.h> 29#include <errno.h>
30// #include <string.h>
31#ifndef WIN32_LEAN_AND_MEAN 30#ifndef WIN32_LEAN_AND_MEAN
32# define WIN32_LEAN_AND_MEAN 31# define WIN32_LEAN_AND_MEAN
33#endif 32#endif