You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by rb...@apache.org on 2002/11/20 06:47:39 UTC

cvs commit: apr/test testprocmutex.c

rbb         2002/11/19 21:47:39

  Modified:    test     testprocmutex.c
  Log:
  Call apr_initialize at startup of the child processes.  You cannot have
  an unequal number of apr_terminate and apr_initialize calls.  If you do,
  bad things will happen.  In this case, the bad thing is that if the mutex
  is a semaphore, it will be destroyed before all of the processes die.
  That means that the test will most likely fail.
  
  Revision  Changes    Path
  1.11      +10 -0     apr/test/testprocmutex.c
  
  Index: testprocmutex.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testprocmutex.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- testprocmutex.c	9 Apr 2002 06:45:06 -0000	1.10
  +++ testprocmutex.c	20 Nov 2002 05:47:39 -0000	1.11
  @@ -81,6 +81,16 @@
       apr_sleep (1);
   
       if (apr_proc_fork(*proc, p) == APR_INCHILD) {
  +        /* The parent process has setup all processes to call apr_terminate
  +         * at exit.  But, that means that all processes must also call
  +         * apr_initialize at startup.  You cannot have an unequal number
  +         * of apr_terminate and apr_initialize calls.  If you do, bad things
  +         * will happen.  In this case, the bad thing is that if the mutex
  +         * is a semaphore, it will be destroyed before all of the processes
  +         * die.  That means that the test will most likely fail.
  +         */
  +        apr_initialize();
  +
           while (1) {
               apr_proc_mutex_lock(proc_lock); 
               if (i == MAX_ITER) {