diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2012-03-07 22:01:30 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2012-03-07 22:01:30 +0000 |
commit | 9ceb8274601e0b7098c73f8e315f08bfc0da0128 (patch) | |
tree | 5dd0ba364a65ab799cfd0986a7e90a9f3f6b2c2b | |
parent | 8f1dc5bcc7598e53a97c0ccda8bf81e319cabd14 (diff) |
another questionable hang.
-rw-r--r-- | regress/lib/libpthread/process_kill/Makefile | 5 | ||||
-rw-r--r-- | regress/lib/libpthread/process_kill/process_kill.c | 44 |
2 files changed, 49 insertions, 0 deletions
diff --git a/regress/lib/libpthread/process_kill/Makefile b/regress/lib/libpthread/process_kill/Makefile new file mode 100644 index 00000000000..906b2f41b74 --- /dev/null +++ b/regress/lib/libpthread/process_kill/Makefile @@ -0,0 +1,5 @@ +# $OpenBSD: Makefile,v 1.1 2012/03/07 22:01:29 fgsch Exp $ + +PROG = process_kill + +.include <bsd.regress.mk> diff --git a/regress/lib/libpthread/process_kill/process_kill.c b/regress/lib/libpthread/process_kill/process_kill.c new file mode 100644 index 00000000000..51106362838 --- /dev/null +++ b/regress/lib/libpthread/process_kill/process_kill.c @@ -0,0 +1,44 @@ +/* $OpenBSD: process_kill.c,v 1.1 2012/03/07 22:01:29 fgsch Exp $ */ +/* + * Federico G. Schwindt <fgsch@openbsd.org>, 2012. Public Domain. + */ + +#include <pthread.h> +#include <signal.h> +#include <stdlib.h> +#include <unistd.h> +#include "test.h" + +void +deadlock(int sig) +{ + PANIC("deadlock detected"); +} + +void +handler(int sig) +{ + +} + +void * +killer(void *arg) +{ + sleep(2); + CHECKe(kill(getpid(), SIGUSR1)); + return (NULL); +} + +int +main(int argc, char **argv) +{ + pthread_t t; + + ASSERT(signal(SIGALRM, deadlock) != SIG_ERR); + ASSERT(signal(SIGUSR1, handler) != SIG_ERR); + CHECKr(pthread_create(&t, NULL, killer, NULL)); + alarm(5); + sleep(15); + CHECKr(pthread_join(t, NULL)); + SUCCEED; +} |