You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Ian Holsman <ia...@cnet.com> on 2001/08/01 19:45:31 UTC

Re: cvs commit: apr/test testthread.c

On 01 Aug 2001 16:49:29 +0000, trawick@apache.org wrote:
> trawick     01/08/01 09:49:29
> 
>   Modified:    test     testthread.c
>   Log:
>   get rid of vestigial !APR_HAS_THREADS logic
>   
won't removing the #ifdef cause systems which have no thread support
to fail on building the test directory?
>   flush stdout before writing to stderr, as no '\n' was
>   written previously to the stdout buffer
>   
>   Revision  Changes    Path
>   1.20      +9 -4      apr/test/testthread.c
>   
>   Index: testthread.c
>   ===================================================================
>   RCS file: /home/cvs/apr/test/testthread.c,v
>   retrieving revision 1.19
>   retrieving revision 1.20
>   diff -u -r1.19 -r1.20
>   --- testthread.c	2001/07/27 19:21:39	1.19
>   +++ testthread.c	2001/08/01 16:49:29	1.20
>   @@ -134,7 +134,6 @@
>    
>    int main(void)
>    {
>   -#if APR_HAS_THREADS
>        apr_thread_t *t1;
>        apr_thread_t *t2;
>        apr_thread_t *t3;
>   @@ -148,6 +147,7 @@
>    
>        fprintf(stdout, "Initializing the context......."); 
>        if (apr_pool_create(&context, NULL) != APR_SUCCESS) {
>   +        fflush(stdout);
>            fprintf(stderr, "could not initialize\n");
>            exit(-1);
>        }
>   @@ -156,6 +156,7 @@
>        fprintf(stdout, "Initializing the lock......."); 
>        s1 = apr_lock_create(&thread_lock, APR_MUTEX, APR_INTRAPROCESS, "lock.file", context); 
>        if (s1 != APR_SUCCESS) {
>   +        fflush(stdout);
>            fprintf(stderr, "Could not create lock\n");
>            exit(-1);
>        }
>   @@ -168,6 +169,7 @@
>        s4 = apr_thread_create(&t4, NULL, thread_func4, NULL, context);
>        if (s1 != APR_SUCCESS || s2 != APR_SUCCESS || 
>            s3 != APR_SUCCESS || s4 != APR_SUCCESS) {
>   +        fflush(stdout);
>            fprintf(stderr, "Error starting thread\n");
>            exit(-1);
>        }
>   @@ -178,24 +180,27 @@
>        apr_thread_join(&s2, t2);
>        apr_thread_join(&s3, t3);
>        apr_thread_join(&s4, t4);
>   -    fprintf (stdout, "OK\n");
>   +    fprintf(stdout, "OK\n");
>    
>        fprintf(stdout, "Checking thread's returned value.......");
>        if (s1 != exit_ret_val || s2 != exit_ret_val ||
>            s3 != exit_ret_val || s4 != exit_ret_val) {
>   -        fprintf(stderr, "Invalid return value (not expected value)\n");
>   +        fflush(stdout);
>   +        fprintf(stderr, 
>   +                "Invalid return value %d/%d/%d/%d (not expected value %d)\n",
>   +                s1, s2, s3, s4, exit_ret_val);
>            exit(-1);
>        }
>        fprintf(stdout, "OK\n");
>    
>        fprintf(stdout, "Checking if locks worked......."); 
>        if (x != 40000) {
>   +        fflush(stdout);
>            fprintf(stderr, "The locks didn't work????  %d\n", x);
>        }
>        else {
>            fprintf(stdout, "Everything is working!\n");
>        }
>   -#endif
>        return 1;
>    }
>    
>   
>   
>   
-- 
Ian Holsman
Performance Measurement & Analysis
CNET Networks    -    415 364-8608


Re: cvs commit: apr/test testthread.c

Posted by Jeff Trawick <tr...@attglobal.net>.
Ian Holsman <ia...@cnet.com> writes:

> On 01 Aug 2001 16:49:29 +0000, trawick@apache.org wrote:
> > trawick     01/08/01 09:49:29
> > 
> >   Modified:    test     testthread.c
> >   Log:
> >   get rid of vestigial !APR_HAS_THREADS logic
> >   
> won't removing the #ifdef cause systems which have no thread support
> to fail on building the test directory?

!APR_HAS_THREADS logic remains.  What I removed was some old
stuff which should have been removed already.

old:

#if !APR_HAS_THREADS

tiny main

#else

support code

main
{
#if APR_HAS_THREADS

stuff

#endif
}

#endif

I zapped the uninteresting inner check for APR_HAS_THREADS. 
-- 
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Re: cvs commit: apr/test testthread.c

Posted by Jeff Trawick <tr...@attglobal.net>.
Ian Holsman <ia...@cnet.com> writes:

> On 01 Aug 2001 16:49:29 +0000, trawick@apache.org wrote:
> > trawick     01/08/01 09:49:29
> > 
> >   Modified:    test     testthread.c
> >   Log:
> >   get rid of vestigial !APR_HAS_THREADS logic
> >   
> won't removing the #ifdef cause systems which have no thread support
> to fail on building the test directory?

!APR_HAS_THREADS logic remains.  What I removed was some old
stuff which should have been removed already.

old:

#if !APR_HAS_THREADS

tiny main

#else

support code

main
{
#if APR_HAS_THREADS

stuff

#endif
}

#endif

I zapped the uninteresting inner check for APR_HAS_THREADS. 
-- 
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...