diff options
Diffstat (limited to 'pr/tests/io_timeoutk.c')
-rw-r--r-- | pr/tests/io_timeoutk.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/pr/tests/io_timeoutk.c b/pr/tests/io_timeoutk.c index cf6cb491..0d22a03b 100644 --- a/pr/tests/io_timeoutk.c +++ b/pr/tests/io_timeoutk.c @@ -41,7 +41,7 @@ PRIntn failed_already=0; PRIntn debug_mode; -void +void thread_main(void *_info) { threadInfo *info = (threadInfo *)_info; @@ -50,7 +50,7 @@ thread_main(void *_info) PRFileDesc *listenSock = NULL; PRFileDesc *clientSock; PRStatus rv; - + if (debug_mode) printf("thread %d is alive\n", info->id); listenSock = PR_NewTCPSocket(); @@ -58,7 +58,7 @@ thread_main(void *_info) if (debug_mode) printf("unable to create listen socket\n"); goto dead; } - + listenAddr.inet.family = AF_INET; listenAddr.inet.port = PR_htons(BASE_PORT + info->id); listenAddr.inet.ip = PR_htonl(INADDR_ANY); @@ -74,13 +74,13 @@ thread_main(void *_info) goto dead; } - if (debug_mode) printf("thread %d going into accept for %d seconds\n", + if (debug_mode) printf("thread %d going into accept for %d seconds\n", info->id, info->accept_timeout + info->id); clientSock = PR_Accept(listenSock, &clientAddr, PR_SecondsToInterval(info->accept_timeout +info->id)); if (clientSock == NULL) { - if (PR_GetError() == PR_IO_TIMEOUT_ERROR) + if (PR_GetError() == PR_IO_TIMEOUT_ERROR) if (debug_mode) { printf("PR_Accept() timeout worked!\n"); printf("TEST FAILED! PR_Accept() returned error %d\n", @@ -119,7 +119,7 @@ thread_test(PRInt32 scope, PRInt32 num_threads) dead_lock = PR_NewLock(); dead_cv = PR_NewCondVar(dead_lock); alive = num_threads; - + for (index = 0; index < num_threads; index++) { threadInfo *info = (threadInfo *)malloc(sizeof(threadInfo)); @@ -128,7 +128,7 @@ thread_test(PRInt32 scope, PRInt32 num_threads) info->dead_cv = dead_cv; info->alive = &alive; info->accept_timeout = DEFAULT_ACCEPT_TIMEOUT; - + thr = PR_CreateThread( PR_USER_THREAD, thread_main, (void *)info, @@ -179,7 +179,7 @@ int main(int argc, char **argv) PL_DestroyOptState(opt); /* main test */ - + if (argc > 2) num_threads = atoi(argv[2]); else @@ -192,8 +192,8 @@ int main(int argc, char **argv) thread_test(PR_GLOBAL_THREAD, num_threads); PR_Cleanup(); - - if(failed_already) + + if(failed_already) return 1; else return 0; |