summaryrefslogtreecommitdiff
path: root/lib/libc_r/TEST/test_setjmp.c
diff options
context:
space:
mode:
authorDavid Leonard <d@cvs.openbsd.org>1999-12-02 02:43:37 +0000
committerDavid Leonard <d@cvs.openbsd.org>1999-12-02 02:43:37 +0000
commitf3f6eb43543ab169a1b75d2271fe906f2d922990 (patch)
treed2ea001302f9c535bf5f2814629398f8235eee4a /lib/libc_r/TEST/test_setjmp.c
parent0ca8ab340d37b7aae4186d61084ccad5737eb443 (diff)
add _setjmp/_longjmp test
Diffstat (limited to 'lib/libc_r/TEST/test_setjmp.c')
-rw-r--r--lib/libc_r/TEST/test_setjmp.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/libc_r/TEST/test_setjmp.c b/lib/libc_r/TEST/test_setjmp.c
index 8d78f4d5f63..3a2b7bcdf22 100644
--- a/lib/libc_r/TEST/test_setjmp.c
+++ b/lib/libc_r/TEST/test_setjmp.c
@@ -4,6 +4,22 @@
int reached;
void *
+_jump(arg)
+ void *arg;
+{
+ jmp_buf foo;
+
+ reached = 0;
+ if (_setjmp(foo)) {
+ ASSERT(reached);
+ return NULL;
+ }
+ reached = 1;
+ _longjmp(foo, 1);
+ PANIC("_longjmp");
+}
+
+void *
jump(arg)
void *arg;
{
@@ -27,10 +43,16 @@ main()
printf("jumping in main thread\n");
(void)jump(NULL);
+ 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));
+ printf("_jumping in child thread\n");
+ CHECKr(pthread_create(&child, NULL, _jump, NULL));
+ CHECKr(pthread_join(child, &res));
+
SUCCEED;
}