diff options
author | rsc <devnull@localhost> | 2006-04-21 03:34:44 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2006-04-21 03:34:44 +0000 |
commit | 110c707dda7d14af657a0cc184e60eb42af30c88 (patch) | |
tree | c7e2cb832189c183e7af67ec01cecb9d4a1bc4c6 /src/libthread/test | |
parent | 6b11fe88cb3dd3a8181f56c24a33e065067d2170 (diff) | |
download | plan9port-110c707dda7d14af657a0cc184e60eb42af30c88.tar.gz plan9port-110c707dda7d14af657a0cc184e60eb42af30c88.tar.bz2 plan9port-110c707dda7d14af657a0cc184e60eb42af30c88.zip |
darwin 386 start
Diffstat (limited to 'src/libthread/test')
-rw-r--r-- | src/libthread/test/tcontext.c | 27 | ||||
-rw-r--r-- | src/libthread/test/thello.c | 10 |
2 files changed, 37 insertions, 0 deletions
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); +} diff --git a/src/libthread/test/thello.c b/src/libthread/test/thello.c new file mode 100644 index 00000000..c5732165 --- /dev/null +++ b/src/libthread/test/thello.c @@ -0,0 +1,10 @@ +#include <u.h> +#include <libc.h> +#include <thread.h> + +void +threadmain(int argc, char **argv) +{ + print("hello, world\n"); +} + |