summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-10-17 03:55:35 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-10-17 03:55:35 +0000
commit42a59387a67f4c5c9604b2ae36a3cbbf5e02f47f (patch)
tree08a293318a149e105b32ab67dbe9fd3dfe451ea9
parent80f71e4393e819cdd234fbf1d07e332694bdcd71 (diff)
add eina barrier to efl tree.
SVN revision: 78100
-rw-r--r--configure.ac7
-rw-r--r--m4/efl_threads.m412
-rw-r--r--src/lib/eina/Makefile.am3
-rw-r--r--src/lib/eina/eina_config.h.in5
-rw-r--r--src/lib/eina/eina_inline_lock_barrier.x (renamed from legacy/eina/src/include/eina_inline_lock_barrier.x)0
-rw-r--r--src/lib/eina/eina_inline_lock_posix.x34
-rw-r--r--src/lib/eina/eina_inline_lock_win32.x2
-rw-r--r--src/lib/eina/eina_inline_lock_wince.x2
-rw-r--r--src/lib/eina/eina_lock.h8
9 files changed, 71 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index e7e3cb2..ceb351b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -513,6 +513,11 @@ EINA_CONFIG(ENABLE_LOG, test "x${enable_log}" = "xyes")
513 513
514EFL_CHECK_THREADS 514EFL_CHECK_THREADS
515 515
516if ! test "x${efl_have_pthread_barrier}" = "xno" ; then
517 EINA_CONFIGURE_HAVE_PTHREAD_BARRIER="#define EINA_HAVE_PTHREAD_BARRIER"
518fi
519AC_SUBST(EINA_CONFIGURE_HAVE_PTHREAD_BARRIER)
520
516EINA_CONFIG(HAVE_DEBUG_THREADS, test "$want_debug_threads" = "yes") 521EINA_CONFIG(HAVE_DEBUG_THREADS, test "$want_debug_threads" = "yes")
517 522
518### Modules 523### Modules
@@ -802,7 +807,7 @@ echo "Configuration Options Summary:"
802echo 807echo
803echo " OS...................: ${host_os}" 808echo " OS...................: ${host_os}"
804echo " Build Profile........: ${build_profile}" 809echo " Build Profile........: ${build_profile}"
805echo " Threads Type.........: ${efl_have_threads} (spinlocks: ${efl_have_posix_threads_spinlock})" 810echo " Threads Type.........: ${efl_have_threads} (spinlocks: ${efl_have_posix_threads_spinlock}) (barrier: ${efl_have_pthread_barrier})"
806echo " Cryptographic System.: ${build_crypto}" 811echo " Cryptographic System.: ${build_crypto}"
807if test "x${have_windows}" = "xyes" ; then 812if test "x${have_windows}" = "xyes" ; then
808 echo " Windows version......: ${_efl_windows_version}" 813 echo " Windows version......: ${_efl_windows_version}"
diff --git a/m4/efl_threads.m4 b/m4/efl_threads.m4
index 90a5f8a..bd3a818 100644
--- a/m4/efl_threads.m4
+++ b/m4/efl_threads.m4
@@ -64,6 +64,16 @@ id = pthread_self();
64 EFL_PTHREAD_LIBS=${_efl_threads_libs} 64 EFL_PTHREAD_LIBS=${_efl_threads_libs}
65 ], 65 ],
66 [_efl_have_posix_threads="no"]) 66 [_efl_have_posix_threads="no"])
67 AC_LINK_IFELSE(
68 [AC_LANG_PROGRAM([[
69#include <pthread.h>
70 ]],
71 [[
72pthread_barrier_t barrier;
73pthread_barrier_init(&barrier, NULL, 1);
74 ]])],
75 [efl_have_pthread_barrier="yes"],
76 [efl_have_pthread_barrier="no"])
67 CFLAGS=${SAVE_CFLAGS} 77 CFLAGS=${SAVE_CFLAGS}
68 LIBS=${SAVE_LIBS} 78 LIBS=${SAVE_LIBS}
69 79
@@ -75,8 +85,10 @@ if test "x${_efl_have_posix_threads}" = "xyes" ; then
75else 85else
76 if test "x${_efl_have_win32_threads}" = "xyes" ; then 86 if test "x${_efl_have_win32_threads}" = "xyes" ; then
77 efl_have_threads="Windows" 87 efl_have_threads="Windows"
88 efl_have_pthread_barrier="no"
78 else 89 else
79 efl_have_threads="no" 90 efl_have_threads="no"
91 efl_have_pthread_barrier="no"
80 fi 92 fi
81fi 93fi
82AC_MSG_RESULT([${efl_have_threads}]) 94AC_MSG_RESULT([${efl_have_threads}])
diff --git a/src/lib/eina/Makefile.am b/src/lib/eina/Makefile.am
index c3eb252..287b29a 100644
--- a/src/lib/eina/Makefile.am
+++ b/src/lib/eina/Makefile.am
@@ -81,7 +81,8 @@ eina_refcount.h \
81eina_mmap.h \ 81eina_mmap.h \
82eina_xattr.h \ 82eina_xattr.h \
83eina_value.h \ 83eina_value.h \
84eina_inline_value.x 84eina_inline_value.x \
85eina_inline_lock_barrier.x
85 86
86# Will be back for developper after 1.2. 87# Will be back for developper after 1.2.
87# eina_model.h 88# eina_model.h
diff --git a/src/lib/eina/eina_config.h.in b/src/lib/eina/eina_config.h.in
index 8b3b356..9790270 100644
--- a/src/lib/eina/eina_config.h.in
+++ b/src/lib/eina/eina_config.h.in
@@ -51,6 +51,11 @@
51#define EINA_HAVE_THREADS 51#define EINA_HAVE_THREADS
52#endif 52#endif
53 53
54#ifdef EINA_HAVE_PTHREAD_BARRIER
55# undef EINA_HAVE_PTHREAD_BARRIER
56#endif
57@EINA_CONFIGURE_HAVE_PTHREAD_BARRIER@
58
54#ifdef EINA_HAVE_DEBUG_THREADS 59#ifdef EINA_HAVE_DEBUG_THREADS
55# undef EINA_HAVE_DEBUG_THREADS 60# undef EINA_HAVE_DEBUG_THREADS
56#endif 61#endif
diff --git a/legacy/eina/src/include/eina_inline_lock_barrier.x b/src/lib/eina/eina_inline_lock_barrier.x
index 536e26c..536e26c 100644
--- a/legacy/eina/src/include/eina_inline_lock_barrier.x
+++ b/src/lib/eina/eina_inline_lock_barrier.x
diff --git a/src/lib/eina/eina_inline_lock_posix.x b/src/lib/eina/eina_inline_lock_posix.x
index 86cf1f7..88c4b61c 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
diff --git a/src/lib/eina/eina_inline_lock_win32.x b/src/lib/eina/eina_inline_lock_win32.x
index 856f972..383a543 100644
--- a/src/lib/eina/eina_inline_lock_win32.x
+++ b/src/lib/eina/eina_inline_lock_win32.x
@@ -551,4 +551,6 @@ eina_semaphore_release(Eina_Semaphore *sem, int count_release)
551 return ReleaseSemaphore(*sem, count_release, NULL) ? EINA_TRUE : EINA_FALSE; 551 return ReleaseSemaphore(*sem, count_release, NULL) ? EINA_TRUE : EINA_FALSE;
552} 552}
553 553
554#include "eina_inline_lock_barrier.x"
555
554#endif 556#endif
diff --git a/src/lib/eina/eina_inline_lock_wince.x b/src/lib/eina/eina_inline_lock_wince.x
index 38d7e08..7877959 100644
--- a/src/lib/eina/eina_inline_lock_wince.x
+++ b/src/lib/eina/eina_inline_lock_wince.x
@@ -204,4 +204,6 @@ eina_semaphore_release(Eina_Semaphore *sem EINA_UNUSED,
204 return EINA_FALSE; 204 return EINA_FALSE;
205} 205}
206 206
207#include "eina_inline_lock_barrier.x"
208
207#endif 209#endif
diff --git a/src/lib/eina/eina_lock.h b/src/lib/eina/eina_lock.h
index 5260ed9..ceb19d7 100644
--- a/src/lib/eina/eina_lock.h
+++ b/src/lib/eina/eina_lock.h
@@ -106,6 +106,14 @@ static inline Eina_Bool eina_semaphore_lock(Eina_Semaphore *sem);
106/** @relates static Eina_Bool eina_semaphore_release(sem_t *sem, int count_release) */ 106/** @relates static Eina_Bool eina_semaphore_release(sem_t *sem, int count_release) */
107static inline Eina_Bool eina_semaphore_release(Eina_Semaphore *sem, int count_release); 107static inline Eina_Bool eina_semaphore_release(Eina_Semaphore *sem, int count_release);
108 108
109/** @relates static Eina_Bool eina_barrier_new(Eina_Barrier *barrier, int needed) @since 1.8 */
110static inline Eina_Bool eina_barrier_new(Eina_Barrier *barrier, int needed);
111/** @relates static void eina_barrier_free(Eina_Barrier *barrier); @since 1.8 */
112static inline void eina_barrier_free(Eina_Barrier *barrier);
113/** @relates static Eina_Bool eina_barrier_wait(Eina_Barrier *barrier); @since 1.8 */
114static inline Eina_Bool eina_barrier_wait(Eina_Barrier *barrier);
115
116
109#ifdef EINA_HAVE_DEBUG_THREADS 117#ifdef EINA_HAVE_DEBUG_THREADS
110# define EINA_MAIN_LOOP_CHECK_RETURN_VAL(val) \ 118# define EINA_MAIN_LOOP_CHECK_RETURN_VAL(val) \
111 do { \ 119 do { \