diff options
-rw-r--r-- | lib/libc_r/TEST/test_setjmp.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/libc_r/TEST/test_setjmp.c b/lib/libc_r/TEST/test_setjmp.c index 31610fd8387..8d78f4d5f63 100644 --- a/lib/libc_r/TEST/test_setjmp.c +++ b/lib/libc_r/TEST/test_setjmp.c @@ -3,16 +3,34 @@ int reached; -main() +void * +jump(arg) + void *arg; { jmp_buf foo; reached = 0; if (setjmp(foo)) { ASSERT(reached); - SUCCEED; + return NULL; } reached = 1; longjmp(foo, 1); PANIC("longjmp"); } + +int +main() +{ + pthread_t child; + void *res; + + printf("jumping in main thread\n"); + (void)jump(NULL); + + printf("jumping in child thread\n"); + CHECKr(pthread_create(&child, NULL, jump, NULL)); + CHECKr(pthread_join(child, &res)); + + SUCCEED; +} |