aboutsummaryrefslogtreecommitdiff
path: root/src/libthread
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2007-11-05 13:14:52 -0500
committerRuss Cox <rsc@swtch.com>2007-11-05 13:14:52 -0500
commit2640996af869dbdee7c0461c69a0c6e59ed58235 (patch)
treecd5e6cd1b0eb44a2bdb485c8cbe931c41ebc2ed9 /src/libthread
parent88cf5927234499472ad3910aff63803f85fba40b (diff)
downloadplan9port-2640996af869dbdee7c0461c69a0c6e59ed58235.tar.gz
plan9port-2640996af869dbdee7c0461c69a0c6e59ed58235.tar.bz2
plan9port-2640996af869dbdee7c0461c69a0c6e59ed58235.zip
libthread: use our own swapcontext/makecontext even on OS X 10.5
Diffstat (limited to 'src/libthread')
-rw-r--r--src/libthread/sysofiles.sh5
-rw-r--r--src/libthread/threadimpl.h11
2 files changed, 11 insertions, 5 deletions
diff --git a/src/libthread/sysofiles.sh b/src/libthread/sysofiles.sh
index a6836625..cdc1ad02 100644
--- a/src/libthread/sysofiles.sh
+++ b/src/libthread/sysofiles.sh
@@ -20,11 +20,8 @@ case "$tag" in
*-NetBSD-*)
echo ${SYSNAME}-${OBJTYPE}-asm.o $SYSNAME.o
;;
-*-Darwin-[6-8].*)
- echo ${SYSNAME}-${OBJTYPE}-asm.o ${SYSNAME}-${OBJTYPE}.o pthread.o
- ;;
*-Darwin-*)
- echo pthread.o
+ echo ${SYSNAME}-${OBJTYPE}-asm.o ${SYSNAME}-${OBJTYPE}.o pthread.o
;;
*-OpenBSD-*)
echo ${SYSNAME}-${OBJTYPE}-asm.o ${SYSNAME}-${OBJTYPE}.o $SYSNAME.o
diff --git a/src/libthread/threadimpl.h b/src/libthread/threadimpl.h
index 76f676f0..da98e5eb 100644
--- a/src/libthread/threadimpl.h
+++ b/src/libthread/threadimpl.h
@@ -21,11 +21,20 @@ extern int swapcontext(ucontext_t*, ucontext_t*);
extern void makecontext(ucontext_t*, void(*)(), int, ...);
#endif
-#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
+#if defined(__APPLE__)
+ /*
+ * OS X before 10.5 (Leopard) does not provide
+ * swapcontext nor makecontext, so we have to use our own.
+ * In theory, Leopard does provide them, but when we use
+ * them, they seg fault. Maybe we're using them wrong.
+ * So just use our own versions, even on Leopard.
+ */
# define mcontext libthread_mcontext
# define mcontext_t libthread_mcontext_t
# define ucontext libthread_ucontext
# define ucontext_t libthread_ucontext_t
+# define swapcontext libthread_swapcontext
+# define makecontext libthread_makecontext
# if defined(__i386__)
# include "386-ucontext.h"
# else