From 27d0379a9710e7f8cc715af3953b4e8c602bcd0b Mon Sep 17 00:00:00 2001 From: Andrew <16061801+brada4@users.noreply.github.com> Date: Sun, 3 Mar 2019 19:41:44 +0200 Subject: [PATCH] use sleep timed after sched_yield for spinning busy loop --- common.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common.h b/common.h index 7fcd5e316..94b7cd8b3 100644 --- a/common.h +++ b/common.h @@ -366,7 +366,11 @@ typedef int blasint; */ #ifndef YIELDING -#define YIELDING sched_yield() +#define YIELDING nanosleep((const struct timespec[]){{0,10000L}},NULL); +// Line above is equal to following, but compliant with much older POSIX spec +// #define YIELDING usleep(10); +// Linux 2.4 might gain from implied scheduler programming instead +// #define YIELDING sched_yield() #endif /***