bjh         01/09/01 22:34:55

  Modified:    threadproc/os2 thread.c
  Log:
  Clean up the event sem in the apr_thread_once_t.
  
  Revision  Changes    Path
  1.29      +14 -0     apr/threadproc/os2/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/os2/thread.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- thread.c  2001/09/02 05:20:49     1.28
  +++ thread.c  2001/09/02 05:34:55     1.29
  @@ -242,12 +242,26 @@
   
   
   
  +static apr_status_t thread_once_cleanup(void *vcontrol)
  +{
  +    apr_thread_once_t *control = (apr_thread_once_t *)vcontrol;
  +
  +    if (control->sem) {
  +        DosCloseEventSem(control->sem);
  +    }
  +
  +    return APR_SUCCESS;
  +}
  +
  +
  +
   APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control,
                                                  apr_pool_t *p)
   {
       ULONG rc;
       *control = (apr_thread_once_t *)apr_pcalloc(p, 
sizeof(apr_thread_once_t));
       rc = DosCreateEventSem(NULL, &(*control)->sem, 0, TRUE);
  +    apr_pool_cleanup_register(p, control, thread_once_cleanup, 
apr_pool_cleanup_null);
       return APR_FROM_OS_ERROR(rc);
   }
   
  
  
  

Reply via email to