diff options
author | Robert Paal <[email protected]> | 2014-03-21 13:44:23 +0100 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2014-03-26 15:18:58 +0100 |
commit | d5df89a921dbea5711f07b15d1bc595ffc9aa56c (patch) | |
tree | a41808dffb8c7ad04a0fb3e5b33229e2d2aa23e5 /erts/include/internal | |
parent | f4522575a15dd41caf13d2c36eb454407fb3836e (diff) | |
download | otp-d5df89a921dbea5711f07b15d1bc595ffc9aa56c.tar.gz otp-d5df89a921dbea5711f07b15d1bc595ffc9aa56c.tar.bz2 otp-d5df89a921dbea5711f07b15d1bc595ffc9aa56c.zip |
ose: Yielding has to be done differently for background processes.
Diffstat (limited to 'erts/include/internal')
-rw-r--r-- | erts/include/internal/ethread.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/erts/include/internal/ethread.h b/erts/include/internal/ethread.h index 64f1fae6d8..54acd1295a 100644 --- a/erts/include/internal/ethread.h +++ b/erts/include/internal/ethread.h @@ -396,6 +396,18 @@ extern ethr_runtime_t ethr_runtime__; #include "ethr_atomics.h" /* The atomics API */ +#if defined (ETHR_OSE_THREADS) +static ETHR_INLINE void +ose_yield(void) +{ + if (get_ptype(current_process()) == OS_PRI_PROC) { + set_pri(get_pri(current_process())); + } else { + delay(1); + } +} +#endif + #if defined(__GNUC__) && !defined(ETHR_OSE_THREADS) # ifndef ETHR_SPIN_BODY # if defined(__i386__) || defined(__x86_64__) @@ -414,9 +426,9 @@ extern ethr_runtime_t ethr_runtime__; # endif #elif defined(ETHR_OSE_THREADS) # ifndef ETHR_SPIN_BODY -# define ETHR_SPIN_BODY set_pri(get_pri(current_process())) +# define ETHR_SPIN_BODY ose_yield() # else -# error "OSE should use set_pri(get_pri(current_process()))" +# error "OSE should use ose_yield()" # endif #endif @@ -449,7 +461,7 @@ extern ethr_runtime_t ethr_runtime__; # define ETHR_YIELD() (pthread_yield(), 0) # endif # elif defined(ETHR_OSE_THREADS) -# define ETHR_YIELD() (set_pri(get_pri(current_process())), 0) +# define ETHR_YIELD() (ose_yield(), 0) # else # define ETHR_YIELD() (ethr_compiler_barrier(), 0) # endif |