summaryrefslogtreecommitdiff
path: root/src/lib/eina/eina_debug_timer.c
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 /src/lib/eina/eina_debug_timer.c
parent1b45bef1541858c118c96b6074489695c5023aec (diff)
code style
Diffstat (limited to 'src/lib/eina/eina_debug_timer.c')
-rw-r--r--src/lib/eina/eina_debug_timer.c74
1 files changed, 36 insertions, 38 deletions
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]);