summaryrefslogtreecommitdiff
path: root/include/my_pthread.h
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2009-11-24 22:39:05 +0300
committerAlexander Nozdrin <alik@sun.com>2009-11-24 22:39:05 +0300
commitbe0add42f53b23d8a5e279cb3041a3fc93e375a0 (patch)
tree26b4bf4fbbd861b160ce09babbffd07603bb8c11 /include/my_pthread.h
parent932a2751a4aaed69b908432b02581a82e9b5a40e (diff)
parent23159440504311372b2c081c1b5f2cb2f7d98ef3 (diff)
downloadmariadb-git-be0add42f53b23d8a5e279cb3041a3fc93e375a0.tar.gz
Auto-merge from mysql-next-mr.
Diffstat (limited to 'include/my_pthread.h')
-rw-r--r--include/my_pthread.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/my_pthread.h b/include/my_pthread.h
index eff6d654f2e..3b95e2adb73 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -148,6 +148,7 @@ int pthread_join(pthread_t thread, void **value_ptr);
#define pthread_detach_this_thread()
#define pthread_condattr_init(A)
#define pthread_condattr_destroy(A)
+#define pthread_yield() SwitchToThread()
/* per the platform's documentation */
#define pthread_yield() Sleep(0)
@@ -354,6 +355,17 @@ 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_ONE_ARG) && !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 */
+#define pthread_yield() pthread_yield_np()
+#elif defined(HAVE_THR_YIELD)
+#define pthread_yield() thr_yield()
+#endif
+#endif
+
/*
The defines set_timespec and set_timespec_nsec should be used
for calculating an absolute time at which
@@ -632,6 +644,7 @@ struct st_my_thread_var
my_bool init;
struct st_my_thread_var *next,**prev;
void *opt_info;
+ void *stack_ends_here;
#ifndef DBUG_OFF
void *dbug;
char name[THREAD_NAME_SIZE+1];