forked from enlightenment/efl
code style
This commit is contained in:
parent
1b45bef154
commit
6436feb57c
|
@ -126,9 +126,7 @@ _sysmon(void *data EINA_UNUSED, Eina_Thread thr EINA_UNUSED)
|
|||
{
|
||||
Eina_Thread thread = _eina_debug_thread_active[i].thread;
|
||||
// get the clock for the thread and its cpu time usage
|
||||
#ifndef _WIN32
|
||||
pthread_getcpuclockid(thread, &cid);
|
||||
#endif
|
||||
pthread_getcpuclockid(thread, &cid);
|
||||
clock_gettime(cid, &t);
|
||||
// calculate a long timestamp (64bits)
|
||||
tim1 = (_eina_debug_thread_active[i].clok.tv_sec * 1000000000LL) +
|
||||
|
|
|
@ -99,48 +99,46 @@ _monitor(void *_data EINA_UNUSED)
|
|||
# endif
|
||||
|
||||
while (1)
|
||||
{
|
||||
int timeout = -1; //in milliseconds
|
||||
{
|
||||
int timeout = -1; //in milliseconds
|
||||
# ifndef _WIN32
|
||||
pthread_testcancel();
|
||||
pthread_testcancel();
|
||||
# endif
|
||||
eina_spinlock_take(&_lock);
|
||||
if (_timers)
|
||||
{
|
||||
Eina_Debug_Timer *t = eina_list_data_get(_timers);
|
||||
timeout = t->timeout;
|
||||
}
|
||||
eina_spinlock_release(&_lock);
|
||||
|
||||
ret = epoll_wait(epfd, events, MAX_EVENTS, timeout);
|
||||
eina_spinlock_take(&_lock);
|
||||
if (_timers)
|
||||
{
|
||||
Eina_Debug_Timer *t = eina_list_data_get(_timers);
|
||||
timeout = t->timeout;
|
||||
}
|
||||
eina_spinlock_release(&_lock);
|
||||
ret = epoll_wait(epfd, events, MAX_EVENTS, timeout);
|
||||
# ifndef _WIN32
|
||||
pthread_testcancel();
|
||||
pthread_testcancel();
|
||||
# endif
|
||||
|
||||
/* Some timer has been add/removed or we need to exit */
|
||||
if (ret)
|
||||
{
|
||||
char c;
|
||||
if (read(pipeToThread[0], &c, 1) != 1) break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Eina_List *itr, *itr2, *renew = NULL;
|
||||
Eina_Debug_Timer *t;
|
||||
eina_spinlock_take(&_lock);
|
||||
EINA_LIST_FOREACH_SAFE(_timers, itr, itr2, t)
|
||||
{
|
||||
if (itr == _timers || t->rel_time == 0)
|
||||
{
|
||||
_timers = eina_list_remove(_timers, t);
|
||||
if (t->cb(t->data)) renew = eina_list_append(renew, t);
|
||||
else free(t);
|
||||
}
|
||||
}
|
||||
EINA_LIST_FREE(renew, t) _timer_append(t);
|
||||
eina_spinlock_release(&_lock);
|
||||
}
|
||||
}
|
||||
/* Some timer has been add/removed or we need to exit */
|
||||
if (ret)
|
||||
{
|
||||
char c;
|
||||
if (read(pipeToThread[0], &c, 1) != 1) break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Eina_List *itr, *itr2, *renew = NULL;
|
||||
Eina_Debug_Timer *t;
|
||||
eina_spinlock_take(&_lock);
|
||||
EINA_LIST_FOREACH_SAFE(_timers, itr, itr2, t)
|
||||
{
|
||||
if (itr == _timers || t->rel_time == 0)
|
||||
{
|
||||
_timers = eina_list_remove(_timers, t);
|
||||
if (t->cb(t->data)) renew = eina_list_append(renew, t);
|
||||
else free(t);
|
||||
}
|
||||
}
|
||||
EINA_LIST_FREE(renew, t) _timer_append(t);
|
||||
eina_spinlock_release(&_lock);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
_thread_runs = EINA_FALSE;
|
||||
close(pipeToThread[0]);
|
||||
|
|
|
@ -147,20 +147,21 @@ _eina_thread_cancel(Eina_Thread thread)
|
|||
return !success;
|
||||
}
|
||||
|
||||
static inline UNIMPLEMENTED
|
||||
void _eina_thread_setcanceltype(int type, int *oldtype)
|
||||
UNIMPLEMENTED static inline void
|
||||
_eina_thread_setcanceltype(int type, int *oldtype)
|
||||
{
|
||||
#warning _eina_thread_setcanceltype is not implemented.
|
||||
}
|
||||
|
||||
static inline UNIMPLEMENTED
|
||||
int _eina_thread_setcancelstate(int type, int *oldtype)
|
||||
UNIMPLEMENTED static inline int
|
||||
_eina_thread_setcancelstate(int type, int *oldtype)
|
||||
{
|
||||
#warning _eina_thread_setcancelstate is not implemented.
|
||||
return 0;
|
||||
}
|
||||
static inline UNIMPLEMENTED
|
||||
void _eina_thread_cancel_checkpoint(void)
|
||||
|
||||
UNIMPLEMENTED static inline void
|
||||
_eina_thread_cancel_checkpoint(void)
|
||||
{
|
||||
#warning _eina_thread_cancel_checkpoint is not implemented.
|
||||
}
|
||||
|
|
|
@ -21,9 +21,8 @@
|
|||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "eina_config.h"
|
||||
#include "eina_lock.h"
|
||||
#include "eina_lock.h" //in case of a POSIX build, it will include pthread.h with proper flags
|
||||
#include "eina_thread.h"
|
||||
#include "eina_sched.h"
|
||||
#include "eina_cpu.h"
|
||||
|
@ -41,10 +40,6 @@
|
|||
#endif
|
||||
# include <string.h>
|
||||
|
||||
#if defined(EINA_HAVE_PTHREAD_AFFINITY) || defined(EINA_HAVE_PTHREAD_SETNAME)
|
||||
# define cpu_set_t cpuset_t
|
||||
#endif
|
||||
|
||||
EAPI const void *EINA_THREAD_JOIN_CANCELED = EINA_THREAD_CANCELED;
|
||||
|
||||
EAPI Eina_Thread
|
||||
|
@ -58,7 +53,8 @@ eina_thread_equal(Eina_Thread t1, Eina_Thread t2)
|
|||
{
|
||||
return _eina_thread_equal(t1, t2);
|
||||
}
|
||||
static void *_eina_internal_call(void *context)
|
||||
static void *
|
||||
_eina_internal_call(void *context)
|
||||
{
|
||||
Eina_Thread_Call *c = context;
|
||||
void *r;
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "eina_thread.h"
|
||||
#include "unimplemented.h"
|
||||
#include <errno.h>
|
||||
// #include <string.h>
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue