summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcarlos <caiosignor@gmail.com>2020-04-17 14:35:29 -0300
committerJoão Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>2020-04-29 12:13:38 -0300
commit2a29c410aa6c1d23b69649b0f685e6dbcf7bf7c5 (patch)
tree66463a8d2a6ea040229319d7fb4d552ddad6c7fe
parent4cee97de7e1becb523ccf70bab60241ec4404cf2 (diff)
downloadefl-2a29c410aa6c1d23b69649b0f685e6dbcf7bf7c5.tar.gz
eina_inline_thread_posix code convention
-rw-r--r--src/lib/eina/eina_inline_thread_posix.x34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/lib/eina/eina_inline_thread_posix.x b/src/lib/eina/eina_inline_thread_posix.x
index 8f51f2b55e..7c8dcac8ee 100644
--- a/src/lib/eina/eina_inline_thread_posix.x
+++ b/src/lib/eina/eina_inline_thread_posix.x
@@ -28,7 +28,8 @@ _eina_thread_join(Eina_Thread t)
return NULL;
}
-static inline Eina_Bool _eina_thread_name_set(Eina_Thread thread, char *buf)
+static inline Eina_Bool
+_eina_thread_name_set(Eina_Thread thread, char *buf)
{
#ifndef __linux__
pthread_set_name_np((pthread_t)t, buf);
@@ -48,15 +49,14 @@ _eina_thread_create(Eina_Thread *t, int affinity, void *(*func)(void *data), voi
pthread_attr_init(&attr);
if (affinity >= 0)
- {
-#ifdef EINA_HAVE_PTHREAD_AFFINITY
- cpu_set_t cpu;
-
- CPU_ZERO(&cpu);
- CPU_SET(affinity, &cpu);
- pthread_attr_setaffinity_np(&attr, sizeof(cpu), &cpu);
-#endif
- }
+ {
+ #ifdef EINA_HAVE_PTHREAD_AFFINITY
+ cpu_set_t cpu;
+ CPU_ZERO(&cpu);
+ CPU_SET(affinity, &cpu);
+ pthread_attr_setaffinity_np(&attr, sizeof(cpu), &cpu);
+ #endif
+ }
/* setup initial locks */
@@ -92,7 +92,8 @@ _eina_thread_equal(Eina_Thread t1, Eina_Thread t2)
return !!pthread_equal((pthread_t)t1, (pthread_t)t2);
}
-static inline Eina_Bool _eina_thread_cancel(Eina_Thread thread)
+static inline Eina_Bool
+_eina_thread_cancel(Eina_Thread thread)
{
return pthread_cancel((pthread_t)thread);
}
@@ -103,14 +104,18 @@ _eina_thread_self(void)
return (Eina_Thread)pthread_self();
}
-static inline void _eina_thread_setcanceltype(int type, int *oldtype)
+static inline void
+_eina_thread_setcanceltype(int type, int *oldtype)
{
pthread_setcanceltype(EINA_THREAD_CANCEL_DEFERRED, &oldtype);
}
-static inline int _eina_thread_setcancelstate(int type, int *oldtype)
+
+static inline int
+_eina_thread_setcancelstate(int type, int *oldtype)
{
return pthread_setcancelstate(type, &oldtype);
}
+
static inline Eina_Bool
_eina_thread_cancellable_set(Eina_Bool cancellable, Eina_Bool *was_cancellable)
{
@@ -124,9 +129,10 @@ _eina_thread_cancellable_set(Eina_Bool cancellable, Eina_Bool *was_cancellable)
r = _eina_thread_setcancelstate(state, &old);
if (was_cancellable && r == 0)
- *was_cancellable = (old == EINA_THREAD_CANCEL_ENABLE);
+ *was_cancellable = (old == EINA_THREAD_CANCEL_ENABLE);
return r == 0;
}
+
static inline void _eina_thread_cancel_checkpoint(){
pthread_testcancel();
} \ No newline at end of file