summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2021-10-25 22:21:27 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2021-10-26 15:05:13 +0200
commit1f70e4b00cc6edf695a05a448ff3aff2eee070bb (patch)
treea230d23bc32607f051b626e08353e3e9ad6d8f4f
parent1fb4537e6fe9c1578c2857542fff91e00c0e3292 (diff)
downloadmariadb-git-1f70e4b00cc6edf695a05a448ff3aff2eee070bb.tar.gz
pthread_yield() is depricated now, so use sched_yield() if possible.
-rw-r--r--include/my_pthread.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/include/my_pthread.h b/include/my_pthread.h
index f369b765edd..be336b00a35 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -289,16 +289,18 @@ void my_pthread_attr_getstacksize(pthread_attr_t *attrib, size_t *size);
int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
#endif
-#if !defined(HAVE_PTHREAD_YIELD_ZERO_ARG)
-/* no pthread_yield() available */
#ifdef HAVE_SCHED_YIELD
#define pthread_yield() sched_yield()
-#elif defined(HAVE_PTHREAD_YIELD_NP) /* can be Mac OS X */
+#else
+#if !defined(HAVE_PTHREAD_YIELD_ZERO_ARG)
+/* no pthread_yield() available */
+#if defined(HAVE_PTHREAD_YIELD_NP) /* can be Mac OS X */
#define pthread_yield() pthread_yield_np()
#elif defined(HAVE_THR_YIELD)
#define pthread_yield() thr_yield()
-#endif
-#endif
+#endif //defined(HAVE_PTHREAD_YIELD_NP)
+#endif //!defined(HAVE_PTHREAD_YIELD_ZERO_ARG)
+#endif //HAVE_SCHED_YIELD
/*
The defines set_timespec and set_timespec_nsec should be used