Skip to content

Commit 0ff51a4

Browse files
authored
Merge pull request #5579 from vtjnash/jn/YIELDING
fix define for YIELDING
2 parents 097d2d9 + 0b2b583 commit 0ff51a4

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

common.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -362,18 +362,6 @@ typedef int blasint;
362362
#define MAX_CPU_NUMBER 2
363363
#endif
364364

365-
#if defined(OS_SUNOS)
366-
#define YIELDING thr_yield()
367-
#endif
368-
369-
#if defined(OS_WINDOWS)
370-
#if defined(_MSC_VER) && !defined(__clang__)
371-
#define YIELDING YieldProcessor()
372-
#else
373-
#define YIELDING SwitchToThread()
374-
#endif
375-
#endif
376-
377365
#if defined(ARMV7) || defined(ARMV6) || defined(ARMV8) || defined(ARMV5)
378366
#define YIELDING __asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop; \n");
379367
#endif
@@ -398,14 +386,26 @@ typedef int blasint;
398386
#endif
399387
#endif
400388

401-
402389
#ifdef __EMSCRIPTEN__
403390
#define YIELDING
404391
#endif
405392

393+
#if defined(_MSC_VER) && !defined(__clang__)
394+
#undef YIELDING // MSVC doesn't support assembly code
395+
#define YIELDING YieldProcessor()
396+
#endif
397+
406398
#ifndef YIELDING
399+
#if defined(OS_SUNOS)
400+
#define YIELDING thr_yield()
401+
402+
#elif defined(OS_WINDOWS)
403+
#define YIELDING SwitchToThread()
404+
405+
#else // assume POSIX.1-2008
407406
#define YIELDING sched_yield()
408407
#endif
408+
#endif
409409

410410
/***
411411
To alloc job_t on heap or stack.

0 commit comments

Comments
 (0)