From 200fbe924466720bd2a8c5eb05b05d67b0a2414c Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Thu, 14 Mar 2013 15:42:19 +0100 Subject: Added support for ENEA OSE This port has support for both non-smp and smp. It contains a new way to do io checking in which erts_poll_wait receives the payload of the polled entity. This has implications for all linked-in drivers. --- erts/include/internal/ethr_mutex.h | 22 +++++++ erts/include/internal/ethread.h | 97 +++++++++++++++++++++++++++++- erts/include/internal/ose/ethr_event.h | 104 +++++++++++++++++++++++++++++++++ 3 files changed, 221 insertions(+), 2 deletions(-) create mode 100644 erts/include/internal/ose/ethr_event.h (limited to 'erts/include') diff --git a/erts/include/internal/ethr_mutex.h b/erts/include/internal/ethr_mutex.h index 86a1e9fbdf..9511add075 100644 --- a/erts/include/internal/ethr_mutex.h +++ b/erts/include/internal/ethr_mutex.h @@ -103,6 +103,9 @@ void LeaveCriticalSection(CRITICAL_SECTION *); #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 @@ -255,6 +258,25 @@ 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 diff --git a/erts/include/internal/ethread.h b/erts/include/internal/ethread.h index 38b8e9e9b6..581eb22edb 100644 --- a/erts/include/internal/ethread.h +++ b/erts/include/internal/ethread.h @@ -37,6 +37,11 @@ # define ETHR_DEBUG #endif +#if defined(__PPC__) || defined (__POWERPC) +/* OSE compiler should be fixed! */ +#define __ppc__ +#endif + #if defined(ETHR_DEBUG) # undef ETHR_XCHK # define ETHR_XCHK 1 @@ -190,6 +195,36 @@ typedef DWORD ethr_tsd_key; #define ETHR_YIELD() (Sleep(0), 0) +#elif defined(ETHR_OSE_THREADS) + +#include "ose.h" +#undef NIL + +#if defined(ETHR_HAVE_PTHREAD_H) +#include +#endif + +typedef struct { + PROCESS id; + unsigned int tsd_key_index; + void *res; +} ethr_tid; + +struct ethr_tsd_key__ { + PROCESS id; + char key[]; +}; +typedef struct ethr_tsd_key__* ethr_tsd_key; + +#undef ETHR_HAVE_ETHR_SIG_FUNCS + +#define ETHR_USE_OWN_RWMTX_IMPL__ +#define ETHR_USE_OWN_MTX_IMPL__ +#define ETHR_HAVE_THREAD_NAMES +#define ETHR_HAVE_THREAD_NICENESS + +#define ETHR_PPC_HAVE_NO_LWSYNC + #else /* No supported thread lib found */ #ifdef ETHR_NO_SUPP_THR_LIB_NOT_FATAL @@ -367,7 +402,7 @@ extern ethr_runtime_t ethr_runtime__; #include "ethr_atomics.h" /* The atomics API */ -#if defined(__GNUC__) +#if defined(__GNUC__) && !defined(ETHR_OSE_THREADS) # ifndef ETHR_SPIN_BODY # if defined(__i386__) || defined(__x86_64__) # define ETHR_SPIN_BODY __asm__ __volatile__("rep;nop" : : : "memory") @@ -383,9 +418,20 @@ extern ethr_runtime_t ethr_runtime__; # ifndef ETHR_SPIN_BODY # define ETHR_SPIN_BODY do {YieldProcessor();ETHR_COMPILER_BARRIER;} while(0) # endif +#elif defined(ETHR_OSE_THREADS) +# ifndef ETHR_SPIN_BODY +# define ETHR_SPIN_BODY delay(1) +# else +# error "Have to use delay on OSE" +# endif #endif +#ifndef ETHR_OSE_THREADS #define ETHR_YIELD_AFTER_BUSY_LOOPS 50 +#else +#define ETHR_YIELD_AFTER_BUSY_LOOPS 0 +#endif + #ifndef ETHR_SPIN_BODY # define ETHR_SPIN_BODY ETHR_COMPILER_BARRIER @@ -408,6 +454,8 @@ extern ethr_runtime_t ethr_runtime__; # else # define ETHR_YIELD() (pthread_yield(), 0) # endif +# elif defined(ETHR_OSE_THREADS) +# define ETHR_YIELD() (delay(1), 0) # else # define ETHR_YIELD() (ethr_compiler_barrier(), 0) # endif @@ -459,9 +507,20 @@ typedef struct { typedef struct { int detached; /* boolean (default false) */ int suggested_stack_size; /* kilo words (default sys dependent) */ +#ifdef ETHR_OSE_THREADS + char *name; + OSPRIORITY prio; + U32 coreNo; +#endif } ethr_thr_opts; +#if defined(ETHR_OSE_THREADS) +/* Default ethr name is big as we want to be able to sprint stuff in there */ +#define ETHR_THR_OPTS_DEFAULT_INITER \ + {0, -1, "ethread", get_pri(current_process()), 0} +#else #define ETHR_THR_OPTS_DEFAULT_INITER {0, -1} +#endif #if !defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHR_AUX_IMPL__) @@ -571,8 +630,10 @@ typedef struct ethr_ts_event_ ethr_ts_event; /* Needed by ethr_mutex.h */ #if defined(ETHR_WIN32_THREADS) # include "win/ethr_event.h" -#else +#elif defined(ETHR_PTHREADS) # include "pthread/ethr_event.h" +#elif defined(ETHR_OSE_THREADS) +# include "ose/ethr_event.h" #endif int ethr_set_main_thr_status(int, int); @@ -662,6 +723,38 @@ ETHR_INLINE_FUNC_NAME_(ethr_leave_ts_event)(ethr_ts_event *tsep) #endif +#elif defined (ETHR_OSE_THREADS) + +#if defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHREAD_IMPL__) + +extern char* ethr_ts_event_key__; + +static ETHR_INLINE ethr_ts_event * +ETHR_INLINE_FUNC_NAME_(ethr_get_ts_event)(void) +{ + ethr_ts_event *tsep = (ethr_ts_event *)get_envp(current_process(), + ethr_ts_event_key__); + if (!tsep) { + int res = ethr_get_tmp_ts_event__(&tsep); + if (res != 0) + ETHR_FATAL_ERROR__(res); + ETHR_ASSERT(tsep); + } + return tsep; +} + +static ETHR_INLINE void +ETHR_INLINE_FUNC_NAME_(ethr_leave_ts_event)(ethr_ts_event *tsep) +{ + if (tsep->iflgs & ETHR_TS_EV_TMP) { + int res = ethr_free_ts_event__(tsep); + if (res != 0) + ETHR_FATAL_ERROR__(res); + } +} + +#endif + #endif #include "ethr_mutex.h" /* Need atomic declarations and tse */ diff --git a/erts/include/internal/ose/ethr_event.h b/erts/include/internal/ose/ethr_event.h new file mode 100644 index 0000000000..86811a87db --- /dev/null +++ b/erts/include/internal/ose/ethr_event.h @@ -0,0 +1,104 @@ +/* + * %CopyrightBegin% + * + * Copyright Ericsson AB 2009-2011. All Rights Reserved. + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * %CopyrightEnd% + */ + +/* + * Author: Rickard Green + */ + +//#define USE_PTHREAD_API + +#define ETHR_EVENT_OFF_WAITER__ -1L +#define ETHR_EVENT_OFF__ 1L +#define ETHR_EVENT_ON__ 0L + +#ifdef USE_PTHREAD_API + +typedef struct { + ethr_atomic32_t state; + pthread_mutex_t mtx; + pthread_cond_t cnd; +} ethr_event; + +#if defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHR_EVENT_IMPL__) + +static void ETHR_INLINE +ETHR_INLINE_FUNC_NAME_(ethr_event_set)(ethr_event *e) +{ + ethr_sint32_t val; + val = ethr_atomic32_xchg_mb(&e->state, ETHR_EVENT_ON__); + if (val == ETHR_EVENT_OFF_WAITER__) { + int res = pthread_mutex_lock(&e->mtx); + if (res != 0) + ETHR_FATAL_ERROR__(res); + res = pthread_cond_signal(&e->cnd); + if (res != 0) + ETHR_FATAL_ERROR__(res); + res = pthread_mutex_unlock(&e->mtx); + if (res != 0) + ETHR_FATAL_ERROR__(res); + } +} + +static void ETHR_INLINE +ETHR_INLINE_FUNC_NAME_(ethr_event_reset)(ethr_event *e) +{ + ethr_atomic32_set(&e->state, ETHR_EVENT_OFF__); + ETHR_MEMORY_BARRIER; +} + +#endif + +#else + +typedef struct { + ethr_atomic32_t state; + PROCESS proc; +} ethr_event; + +#if defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHR_EVENT_IMPL__) + +static void ETHR_INLINE +ETHR_INLINE_FUNC_NAME_(ethr_event_set)(ethr_event *e) +{ + ethr_sint32_t val = ethr_atomic32_xchg_mb(&e->state, ETHR_EVENT_ON__); + if (val == ETHR_EVENT_OFF_WAITER__) { + ETHR_ASSERT(get_fsem(e->proc) == -1); + signal_fsem(e->proc); + } +} + +static void ETHR_INLINE +ETHR_INLINE_FUNC_NAME_(ethr_event_reset)(ethr_event *e) +{ + ethr_atomic32_set(&e->state, ETHR_EVENT_OFF__); + ETHR_MEMORY_BARRIER; +} + +#endif + +#endif + +int ethr_event_init(ethr_event *e); +int ethr_event_destroy(ethr_event *e); +int ethr_event_wait(ethr_event *e); +int ethr_event_swait(ethr_event *e, int spincount); +#if !defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHR_EVENT_IMPL__) +void ethr_event_set(ethr_event *e); +void ethr_event_reset(ethr_event *e); +#endif -- cgit v1.2.3 From e6c7086e6befb3eb9e8ad4fb7de62f1ee810508c Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Wed, 25 Sep 2013 11:53:59 +0200 Subject: ose: Debug wait__ does receive_fsem instead of wait_fsem This is done in order to catch rogue signals --- erts/include/internal/ose/ethr_event.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'erts/include') diff --git a/erts/include/internal/ose/ethr_event.h b/erts/include/internal/ose/ethr_event.h index 86811a87db..000a600813 100644 --- a/erts/include/internal/ose/ethr_event.h +++ b/erts/include/internal/ose/ethr_event.h @@ -78,8 +78,17 @@ ETHR_INLINE_FUNC_NAME_(ethr_event_set)(ethr_event *e) { ethr_sint32_t val = ethr_atomic32_xchg_mb(&e->state, ETHR_EVENT_ON__); if (val == ETHR_EVENT_OFF_WAITER__) { - ETHR_ASSERT(get_fsem(e->proc) == -1); - signal_fsem(e->proc); +#ifdef DEBUG + OSFSEMVAL fsem_val = get_fsem(e->proc); + + /* There is a race in this assert. + This is because the state is set before the wait call in wait__. + We hope that a delay of 10 ms is enough */ + if (fsem_val == 0) + delay(10); + ETHR_ASSERT(get_fsem(e->proc) == -1); +#endif + signal_fsem(e->proc); } } -- cgit v1.2.3 From 5dc2c6bfaed18e9a6cd23abe70be785599b5d9cc Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Mon, 21 Oct 2013 17:43:32 +0200 Subject: ose: Change get_envp to ose_get_ppdata for tsd There is a system limit on the number of ppdata that is available but that should not be reached, and ppdata is faster than using get_envp. --- erts/include/internal/ethread.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'erts/include') diff --git a/erts/include/internal/ethread.h b/erts/include/internal/ethread.h index 581eb22edb..7f3786ec63 100644 --- a/erts/include/internal/ethread.h +++ b/erts/include/internal/ethread.h @@ -210,11 +210,7 @@ typedef struct { void *res; } ethr_tid; -struct ethr_tsd_key__ { - PROCESS id; - char key[]; -}; -typedef struct ethr_tsd_key__* ethr_tsd_key; +typedef OSPPDKEY ethr_tsd_key; #undef ETHR_HAVE_ETHR_SIG_FUNCS -- cgit v1.2.3 From 8103fed4090e9f1457fb1705e9a4df0821f5db9b Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Thu, 31 Oct 2013 14:40:33 +0100 Subject: ose,erts: Specify name for tsd keys This simplified debugging on OSE and also limits the number of ppdata keys that are created when beam is restarted. --- erts/include/internal/ethread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'erts/include') diff --git a/erts/include/internal/ethread.h b/erts/include/internal/ethread.h index 7f3786ec63..7307bde8d9 100644 --- a/erts/include/internal/ethread.h +++ b/erts/include/internal/ethread.h @@ -534,7 +534,7 @@ void ethr_thr_exit(void *); ethr_tid ethr_self(void); int ethr_equal_tids(ethr_tid, ethr_tid); -int ethr_tsd_key_create(ethr_tsd_key *); +int ethr_tsd_key_create(ethr_tsd_key *,char *); int ethr_tsd_key_delete(ethr_tsd_key); int ethr_tsd_set(ethr_tsd_key, void *); void *ethr_tsd_get(ethr_tsd_key); -- cgit v1.2.3 From c6d34b4d3e6c7817d066dbe20e9c569ae332d2a6 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Fri, 14 Feb 2014 14:39:49 +0100 Subject: ose: Do not use spinlocks on OSE This is because it is very easy to deadlock/livelock inbetween processes on OSE. --- erts/include/internal/ethread.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'erts/include') diff --git a/erts/include/internal/ethread.h b/erts/include/internal/ethread.h index 7307bde8d9..9b1313c538 100644 --- a/erts/include/internal/ethread.h +++ b/erts/include/internal/ethread.h @@ -220,6 +220,7 @@ typedef OSPPDKEY ethr_tsd_key; #define ETHR_HAVE_THREAD_NICENESS #define ETHR_PPC_HAVE_NO_LWSYNC +#undef ETHR_HAVE_NATIVE_SPINLOCKS #else /* No supported thread lib found */ @@ -457,7 +458,11 @@ extern ethr_runtime_t ethr_runtime__; # endif #endif -#ifdef VALGRIND /* mutex as fallback for spinlock for VALGRIND */ +#if defined(VALGRIND) || defined(ETHR_OSE_THREADS) +/* mutex as fallback for spinlock for VALGRIND and OSE. + OSE cannot use spinlocks as processes working on the + same execution unit have a tendency to deadlock. + */ # undef ETHR_HAVE_NATIVE_SPINLOCKS # undef ETHR_HAVE_NATIVE_RWSPINLOCKS #else -- cgit v1.2.3 From 0f9fd47d9141846950bd439d8401f8a759068136 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Fri, 14 Feb 2014 14:41:49 +0100 Subject: ose: Start using ppdata for tse key --- erts/include/internal/ethread.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'erts/include') diff --git a/erts/include/internal/ethread.h b/erts/include/internal/ethread.h index 9b1313c538..ebddfc8ba8 100644 --- a/erts/include/internal/ethread.h +++ b/erts/include/internal/ethread.h @@ -728,13 +728,12 @@ ETHR_INLINE_FUNC_NAME_(ethr_leave_ts_event)(ethr_ts_event *tsep) #if defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHREAD_IMPL__) -extern char* ethr_ts_event_key__; +extern ethr_tsd_key ethr_ts_event_key__; static ETHR_INLINE ethr_ts_event * ETHR_INLINE_FUNC_NAME_(ethr_get_ts_event)(void) { - ethr_ts_event *tsep = (ethr_ts_event *)get_envp(current_process(), - ethr_ts_event_key__); + ethr_ts_event *tsep = *(ethr_ts_event**)ose_get_ppdata(ethr_ts_event_key__); if (!tsep) { int res = ethr_get_tmp_ts_event__(&tsep); if (res != 0) -- cgit v1.2.3 From 2bf4f22a9488d94ac1fc3c72a4e9d84151744004 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Sun, 23 Feb 2014 18:25:59 +0100 Subject: ose: Yielding the cpu is done "the OSE" way --- erts/include/internal/ethread.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'erts/include') diff --git a/erts/include/internal/ethread.h b/erts/include/internal/ethread.h index ebddfc8ba8..58b4ef55b6 100644 --- a/erts/include/internal/ethread.h +++ b/erts/include/internal/ethread.h @@ -417,9 +417,9 @@ extern ethr_runtime_t ethr_runtime__; # endif #elif defined(ETHR_OSE_THREADS) # ifndef ETHR_SPIN_BODY -# define ETHR_SPIN_BODY delay(1) +# define ETHR_SPIN_BODY set_pri(get_pri(current_process())) # else -# error "Have to use delay on OSE" +# error "OSE should use set_pri(get_pri(current_process()))" # endif #endif @@ -452,7 +452,7 @@ extern ethr_runtime_t ethr_runtime__; # define ETHR_YIELD() (pthread_yield(), 0) # endif # elif defined(ETHR_OSE_THREADS) -# define ETHR_YIELD() (delay(1), 0) +# define ETHR_YIELD() (set_pri(get_pri(current_process())), 0) # else # define ETHR_YIELD() (ethr_compiler_barrier(), 0) # endif -- cgit v1.2.3 From a35d0f5f82f8152f1b953eda039807a7d4f4e9b9 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Sun, 23 Feb 2014 18:26:38 +0100 Subject: ose: Thread priorities configurable from lmconf The pattern used for getting the priority from the lmconf is based on the name of the process created. The pattern is: ERTS_%%PROCESS_NAME%%_PRIO with the %%PROCESS_NAME%% replaced by the prefix of the process the priority applies to. eg: ERTS_SCHEDULER_PRIO=24 applies to processes with name SCHEDULER_1, SCHEDULER_2 etc. --- erts/include/internal/ethread.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'erts/include') diff --git a/erts/include/internal/ethread.h b/erts/include/internal/ethread.h index 58b4ef55b6..8512ba5884 100644 --- a/erts/include/internal/ethread.h +++ b/erts/include/internal/ethread.h @@ -217,7 +217,6 @@ typedef OSPPDKEY ethr_tsd_key; #define ETHR_USE_OWN_RWMTX_IMPL__ #define ETHR_USE_OWN_MTX_IMPL__ #define ETHR_HAVE_THREAD_NAMES -#define ETHR_HAVE_THREAD_NICENESS #define ETHR_PPC_HAVE_NO_LWSYNC #undef ETHR_HAVE_NATIVE_SPINLOCKS @@ -510,7 +509,6 @@ typedef struct { int suggested_stack_size; /* kilo words (default sys dependent) */ #ifdef ETHR_OSE_THREADS char *name; - OSPRIORITY prio; U32 coreNo; #endif } ethr_thr_opts; @@ -518,7 +516,7 @@ typedef struct { #if defined(ETHR_OSE_THREADS) /* Default ethr name is big as we want to be able to sprint stuff in there */ #define ETHR_THR_OPTS_DEFAULT_INITER \ - {0, -1, "ethread", get_pri(current_process()), 0} + {0, -1, "ethread", 0} #else #define ETHR_THR_OPTS_DEFAULT_INITER {0, -1} #endif -- cgit v1.2.3 From 04e8415fa7174e69660f1349457ad473d2921c56 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Wed, 19 Feb 2014 16:45:52 +0100 Subject: ose: Remove uneccesary define --- erts/include/internal/ethread.h | 1 - 1 file changed, 1 deletion(-) (limited to 'erts/include') diff --git a/erts/include/internal/ethread.h b/erts/include/internal/ethread.h index 8512ba5884..7b06b8b231 100644 --- a/erts/include/internal/ethread.h +++ b/erts/include/internal/ethread.h @@ -219,7 +219,6 @@ typedef OSPPDKEY ethr_tsd_key; #define ETHR_HAVE_THREAD_NAMES #define ETHR_PPC_HAVE_NO_LWSYNC -#undef ETHR_HAVE_NATIVE_SPINLOCKS #else /* No supported thread lib found */ -- cgit v1.2.3 From ad9d36c55fb6c77ce0a6163e009313deaa2d2bb0 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Fri, 21 Feb 2014 09:14:34 +0100 Subject: ose: Cleanup of mutex selection defines --- erts/include/internal/ethr_mutex.h | 28 +++------------------------- erts/include/internal/ethread.h | 5 ++--- 2 files changed, 5 insertions(+), 28 deletions(-) (limited to 'erts/include') 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 */ -- cgit v1.2.3