[M3devel] darwin user threads?
Jay K
jay.krell at cornell.edu
Mon Dec 14 13:58:02 CET 2009
oh, search the web for "Darwin getcontext":
http://lists.apple.com/archives/darwin-userlevel/2008/Apr/msg00014.html
Fix for x86 is #define _XOPEN_SOURCE to get the struct to be the right size.
- Jay
From: jay.krell at cornell.edu
To: m3devel at elegosoft.com
Date: Mon, 14 Dec 2009 12:52:12 +0000
Subject: [M3devel] darwin user threads?
It looks like make/get/set/swapcontext aren't viable on MacOSX 10.5.
Better on 10.6?
x86 getcontext seems to corrupt things such that a crash follows shortly.
AMD64 just doesn't work.
I happen to be experimenting again with see http://www.engelschall.com/pw/usenix/2000/pmt-html/
again to ease OpenBSD porting..and had some luck on Darwin, though had trouble getting
the timer to trigger ever or more than once.
$ cat 1.c && gcc -m32 1.c && file a.out && ./a.out ; gcc -m64 1.c && file a.out && ./a.out
#include <errno.h>
#include <stdio.h>
#include <ucontext.h>
int main()
{
ucontext_t a;
int b = getcontext(&a);
printf("%d %d\n", b, errno);
return 0;
}
a.out: Mach-O executable i386
0 0
Segmentation fault
a.out: Mach-O 64-bit executable x86_64
-1 45
$ grep 45 /usr/include/sys/errno.h
#define ENOTSUP 45 /* Operation not supported */
- Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20091214/7dff2531/attachment-0002.html>
More information about the M3devel
mailing list