apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject cvs commit: apr/threadproc/win32 thread.c
Date Sat, 01 Sep 2001 05:10:23 GMT
rbb         01/08/31 22:10:23

  Modified:    include/arch/win32 threadproc.h
               threadproc/win32 thread.c
  Log:
  Implement apr_thread_once for Windows.
  
  Revision  Changes    Path
  1.15      +4 -0      apr/include/arch/win32/threadproc.h
  
  Index: threadproc.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/win32/threadproc.h,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- threadproc.h	2001/07/24 05:16:32	1.14
  +++ threadproc.h	2001/09/01 05:10:23	1.15
  @@ -94,5 +94,9 @@
       apr_int32_t detached;
   };
   
  +struct apr_thread_once_t {
  +    long value;
  +};
  +
   #endif  /* ! THREAD_PROC_H */
   
  
  
  
  1.36      +17 -0     apr/threadproc/win32/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/win32/thread.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- thread.c	2001/08/03 00:31:43	1.35
  +++ thread.c	2001/09/01 05:10:23	1.36
  @@ -221,4 +221,21 @@
       return APR_SUCCESS;
   }
   
  +APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control,
  +                                               apr_pool_t *p)
  +{
  +    control = apr_pcalloc(p, sizeof(**control));
  +    return APR_SUCCESS;
  +}
  +
  +APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control,
  +                                          void (*func)(void))
  +{
  +    InterlockedIncrement(&control->value);
  +    if (control->value == 1) {
  +        func();
  +    }
  +    return APR_SUCCESS;
  +}
  +
   APR_POOL_IMPLEMENT_ACCESSOR_X(thread, cntxt)
  
  
  

Mime
View raw message