From 110c707dda7d14af657a0cc184e60eb42af30c88 Mon Sep 17 00:00:00 2001 From: rsc Date: Fri, 21 Apr 2006 03:34:44 +0000 Subject: darwin 386 start --- src/libthread/test/tcontext.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/libthread/test/tcontext.c (limited to 'src/libthread/test/tcontext.c') diff --git a/src/libthread/test/tcontext.c b/src/libthread/test/tcontext.c new file mode 100644 index 00000000..fa58e063 --- /dev/null +++ b/src/libthread/test/tcontext.c @@ -0,0 +1,27 @@ +#include "../threadimpl.h" +#undef exits + + +ucontext_t c0, c1; +char stack[65536]; + +void +go(void *v) +{ + print("hello, world\n"); + setcontext(&c0); +} + +void +main(void) +{ +// print("in main\n"); + getcontext(&c1); + c1.uc_stack.ss_sp = stack; + c1.uc_stack.ss_size = sizeof stack; + makecontext(&c1, go, 1, 0); + if(getcontext(&c0) == 0) + setcontext(&c1); + print("back in main\n"); + exits(0); +} -- cgit v1.2.3