diff options
author | David Reid <dreid@apache.org> | 2002-01-02 19:47:07 +0000 |
---|---|---|
committer | David Reid <dreid@apache.org> | 2002-01-02 19:47:07 +0000 |
commit | b6eaec527455d281747917ca5a1bf9784e66520e (patch) | |
tree | 493cc60fada830399931e0b24e96e7ed5e4798f6 /test/testsleep.c | |
parent | 38a79d9e7c8a3f167f16fe4d77e0904d05ace5ab (diff) | |
download | apr-b6eaec527455d281747917ca5a1bf9784e66520e.tar.gz |
Make testsleep safe for non threaded platforms :)
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62695 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/testsleep.c')
-rw-r--r-- | test/testsleep.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/test/testsleep.c b/test/testsleep.c index fecd68546..beb7d1d91 100644 --- a/test/testsleep.c +++ b/test/testsleep.c @@ -83,12 +83,17 @@ static void do_sleep(int howlong) } } +#if APR_HAS_THREADS void * APR_THREAD_FUNC time_a_thread(apr_thread_t *thd, void *data) { do_sleep(15); return NULL; } +#define OUTPUT_LINES 8 +#else +#define OUTPUT_LINES 2 +#endif /* APR_HAS_THREADS */ int main(void) { @@ -102,16 +107,21 @@ int main(void) STD_TEST_NEQ("Creating a pool to use", apr_pool_create(&p, NULL)) +#if APR_HAS_THREADS printf("\nI will now start 3 threads, each of which should sleep for\n" - "15 seconds, then exit. The main thread will sleep for a\n" - "45 seconds then wake up.\n" - "All tests will check how long they've been in the land of nod.\n\n"); - printf("If all is working you should see 8 lines below within 45 seconds.\n\n"); + "15 seconds, then exit.\n"); +#endif + printf("The main app will sleep for 45 seconds then wake up.\n"); + printf("All tests will check how long they've been in the land of nod.\n\n"); + printf("If all is working you should see %d lines below within 45 seconds.\n\n", + OUTPUT_LINES); + +#if APR_HAS_THREADS rv = apr_thread_create(&t1, NULL, time_a_thread, NULL, p); rv = apr_thread_create(&t2, NULL, time_a_thread, NULL, p); rv = apr_thread_create(&t3, NULL, time_a_thread, NULL, p); - +#endif do_sleep(45); |