diff options
author | wtc%netscape.com <devnull@localhost> | 2002-01-23 03:05:01 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 2002-01-23 03:05:01 +0000 |
commit | 8daf58e77a499fc6dfb413211f4616ef4c18b6aa (patch) | |
tree | 2e7a9d7c3c77d1111098c2a33236f183909874c8 | |
parent | e879e0ac6eddefff18f8490039f7ced72ed9f8d4 (diff) | |
download | nspr-hg-8daf58e77a499fc6dfb413211f4616ef4c18b6aa.tar.gz |
Run the test on both the primordial thread and another thread.
-rw-r--r-- | pr/tests/sigpipe.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/pr/tests/sigpipe.c b/pr/tests/sigpipe.c index 2c708e29..28e7e251 100644 --- a/pr/tests/sigpipe.c +++ b/pr/tests/sigpipe.c @@ -69,7 +69,7 @@ int main(void) #endif #include <errno.h> -int main(void) +static void Test(void *arg) { #ifdef XP_OS2 HFILE pipefd[2]; @@ -79,9 +79,6 @@ int main(void) int rv; char c = '\0'; - /* This initializes NSPR. */ - PR_SetError(0, 0); - #ifdef XP_OS2 if (DosCreatePipe(&pipefd[0], &pipefd[1], 4096) != 0) { #else @@ -103,6 +100,27 @@ int main(void) } close(pipefd[1]); printf("write to broken pipe failed with EPIPE, as expected\n"); +} + +int main(void) +{ + PRThread *thread; + + /* This initializes NSPR. */ + PR_SetError(0, 0); + + thread = PR_CreateThread(PR_USER_THREAD, Test, NULL, PR_PRIORITY_NORMAL, + PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0); + if (thread == NULL) { + fprintf(stderr, "PR_CreateThread failed\n"); + exit(1); + } + if (PR_JoinThread(thread) == PR_FAILURE) { + fprintf(stderr, "PR_JoinThread failed\n"); + exit(1); + } + Test(NULL); + printf("PASSED\n"); return 0; } |