diff options
author | Lukas Larsson <[email protected]> | 2014-02-21 09:14:34 +0100 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2014-02-24 15:16:08 +0100 |
commit | ad9d36c55fb6c77ce0a6163e009313deaa2d2bb0 (patch) | |
tree | dbfcb0002339ae2ab1e99e8a9f9b94f0bde7ccdb | |
parent | 6d010bd4ea3a5bb182cab4aff4436eb4f058c301 (diff) | |
download | otp-ad9d36c55fb6c77ce0a6163e009313deaa2d2bb0.tar.gz otp-ad9d36c55fb6c77ce0a6163e009313deaa2d2bb0.tar.bz2 otp-ad9d36c55fb6c77ce0a6163e009313deaa2d2bb0.zip |
ose: Cleanup of mutex selection defines
-rw-r--r-- | erts/include/internal/ethr_mutex.h | 28 | ||||
-rw-r--r-- | erts/include/internal/ethread.h | 5 | ||||
-rw-r--r-- | erts/lib_src/common/ethr_mutex.c | 4 |
3 files changed, 8 insertions, 29 deletions
diff --git a/erts/include/internal/ethr_mutex.h b/erts/include/internal/ethr_mutex.h index 9511add075..ee861065c5 100644 --- a/erts/include/internal/ethr_mutex.h +++ b/erts/include/internal/ethr_mutex.h @@ -97,15 +97,12 @@ void LeaveCriticalSection(CRITICAL_SECTION *); #if 0 # define ETHR_MTX_Q_LOCK_SPINLOCK__ # define ETHR_MTX_QLOCK_TYPE__ ethr_spinlock_t -#elif defined(ETHR_PTHREADS) +#elif defined(ETHR_PTHREADS) || defined(ETHR_OSE_THREADS) # define ETHR_MTX_Q_LOCK_PTHREAD_MUTEX__ # define ETHR_MTX_QLOCK_TYPE__ pthread_mutex_t #elif defined(ETHR_WIN32_THREADS) # define ETHR_MTX_Q_LOCK_CRITICAL_SECTION__ # define ETHR_MTX_QLOCK_TYPE__ CRITICAL_SECTION -#elif defined(ETHR_OSE_THREADS) -# define ETHR_MTX_Q_LOCK_PTHREAD_MUTEX__ -# define ETHR_MTX_QLOCK_TYPE__ pthread_mutex_t #else # error Need a qlock implementation #endif @@ -213,7 +210,7 @@ struct ethr_cond_ { #endif }; -#elif defined(ETHR_PTHREADS) && !defined(ETHR_DBG_WIN_MTX_WITH_PTHREADS) +#elif (defined(ETHR_PTHREADS) || defined(ETHR_OSE_THREADS)) && !defined(ETHR_DBG_WIN_MTX_WITH_PTHREADS) typedef struct ethr_mutex_ ethr_mutex; struct ethr_mutex_ { @@ -258,25 +255,6 @@ struct ethr_cond_ { #endif }; -#elif defined(ETHR_OSE_THREADS) - -typedef struct ethr_mutex_ ethr_mutex; -struct ethr_mutex_ { - pthread_mutex_t pt_mtx; -#if ETHR_XCHK - int initialized; -#endif -}; - -typedef struct ethr_cond_ ethr_cond; -struct ethr_cond_ { - pthread_cond_t pt_cnd; -#if ETHR_XCHK - int initialized; -#endif -}; - - #else # error "no mutex implementation" #endif @@ -655,7 +633,7 @@ ETHR_INLINE_MTX_FUNC_NAME_(ethr_mutex_unlock)(ethr_mutex *mtx) #endif /* ETHR_TRY_INLINE_FUNCS */ -#elif defined(ETHR_PTHREADS) && !defined(ETHR_DBG_WIN_MTX_WITH_PTHREADS) +#elif (defined(ETHR_PTHREADS) || defined(ETHR_OSE_THREADS)) && !defined(ETHR_DBG_WIN_MTX_WITH_PTHREADS) #if defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHR_MUTEX_IMPL__) diff --git a/erts/include/internal/ethread.h b/erts/include/internal/ethread.h index 7b06b8b231..2682718962 100644 --- a/erts/include/internal/ethread.h +++ b/erts/include/internal/ethread.h @@ -214,11 +214,10 @@ typedef OSPPDKEY ethr_tsd_key; #undef ETHR_HAVE_ETHR_SIG_FUNCS +/* Out own RW mutexes are probably faster, but use OSEs mutexes */ #define ETHR_USE_OWN_RWMTX_IMPL__ -#define ETHR_USE_OWN_MTX_IMPL__ -#define ETHR_HAVE_THREAD_NAMES -#define ETHR_PPC_HAVE_NO_LWSYNC +#define ETHR_HAVE_THREAD_NAMES #else /* No supported thread lib found */ diff --git a/erts/lib_src/common/ethr_mutex.c b/erts/lib_src/common/ethr_mutex.c index 036914af7b..47f2f884af 100644 --- a/erts/lib_src/common/ethr_mutex.c +++ b/erts/lib_src/common/ethr_mutex.c @@ -1249,7 +1249,7 @@ ethr_cond_wait(ethr_cond *cnd, ethr_mutex *mtx) return 0; } -#elif defined(ETHR_PTHREADS) && !defined(ETHR_DBG_WIN_MTX_WITH_PTHREADS) +#elif (defined(ETHR_PTHREADS) || defined(ETHR_OSE_THREADS)) && !defined(ETHR_DBG_WIN_MTX_WITH_PTHREADS) /* -- pthread mutex and condition variables -------------------------------- */ int @@ -1428,6 +1428,8 @@ void LeaveCriticalSection(CRITICAL_SECTION *cs) ETHR_FATAL_ERROR__(res); } +#else +#error "No mutex implementation found" #endif #define ETHR_CND_WAIT__ ((ethr_sint32_t) 0x11dead11) |