summaryrefslogtreecommitdiff
path: root/src/lib/eina/eina_inline_lock_posix.x
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/eina/eina_inline_lock_posix.x')
-rw-r--r--src/lib/eina/eina_inline_lock_posix.x34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/lib/eina/eina_inline_lock_posix.x b/src/lib/eina/eina_inline_lock_posix.x
index 86cf1f7a7e..88c4b61c11 100644
--- a/src/lib/eina/eina_inline_lock_posix.x
+++ b/src/lib/eina/eina_inline_lock_posix.x
@@ -544,4 +544,38 @@ eina_semaphore_release(Eina_Semaphore *sem, int count_release EINA_UNUSED)
544 return (sem_post(sem) == 0) ? EINA_TRUE : EINA_FALSE; 544 return (sem_post(sem) == 0) ? EINA_TRUE : EINA_FALSE;
545} 545}
546 546
547#ifdef EINA_HAVE_PTHREAD_BARRIER
548typedef struct _Eina_Barrier Eina_Barrier;
549
550struct _Eina_Barrier
551{
552 pthread_barrier_t barrier;
553};
554
555static inline Eina_Bool
556eina_barrier_new(Eina_Barrier *barrier, int needed)
557{
558 if (!pthread_barrier_init(&(barrier->barrier), NULL, needed))
559 return EINA_TRUE;
560 return EINA_FALSE;
561}
562
563static inline void
564eina_barrier_free(Eina_Barrier *barrier)
565{
566 pthread_barrier_destroy(&(barrier->barrier));
567}
568
569static inline Eina_Bool
570eina_barrier_wait(Eina_Barrier *barrier)
571{
572 pthread_barrier_wait(&(barrier->barrier));
573 return EINA_TRUE;
574}
575
576#else
577#include "eina_inline_lock_barrier.x"
578#endif
579
580
547#endif 581#endif