File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -358,14 +358,9 @@ typedef _Atomic(uintptr_t) mi_atomic_guard_t;
358358// Yield
359359// ----------------------------------------------------------------------
360360
361- #if defined(__cplusplus)
362- #include < thread>
363- static inline void mi_atomic_yield (void ) {
364- std::this_thread::yield ();
365- }
366- #elif defined(_WIN32)
361+ #if defined(_WIN32)
367362static inline void mi_atomic_yield (void ) {
368- YieldProcessor ();
363+ YieldProcessor (); // see issue #1215 and #1225 why this is preferred over __yield or SwitchToThread
369364}
370365#elif defined(__SSE2__)
371366#include < emmintrin.h>
@@ -406,7 +401,6 @@ static inline void mi_atomic_yield(void) {
406401#endif
407402#endif
408403#elif defined(__sun)
409- // Fallback for other archs
410404#include < synch.h>
411405static inline void mi_atomic_yield (void ) {
412406 smt_pause ();
@@ -416,6 +410,12 @@ static inline void mi_atomic_yield(void) {
416410static inline void mi_atomic_yield (void ) {
417411 sched_yield ();
418412}
413+ // Fallback for other archs
414+ #elif defined(__cplusplus)
415+ #include < thread>
416+ static inline void mi_atomic_yield (void ) {
417+ std::this_thread::yield ();
418+ }
419419#else
420420#include < unistd.h>
421421static inline void mi_atomic_yield (void ) {
You can’t perform that action at this time.
0 commit comments