On Fri, 2002-07-05 at 14:00, Garrett Rooney wrote:
> On Fri, Jul 05, 2002 at 01:49:04PM -0700, Brian Pane wrote:
>  
> > > it's dying because we both #define away apr_atomic_init and declare it
> > > (because freebsd defines APR_ATOMIC_NEED_CAS_DEFAULT).
> > 
> > How about changing atomic/unix/apr_atomic.c so that it defines
> > a no-op apr_atomic_init() if threads are disabled?
> 
> that works, but you'll have to go get rid of all the places that do a
> #define apr_atomic_init APR_SUCCESS, and move the declaration outside
> of the #if defined(APR_ATOMIC_NEED_CAS_DEFAULT).
> 
> then just add:
> 
> #else
> 
> apr_status_t apr_atomic_init(apr_pool_t *p)
> {
>     return APR_SUCCESS;
> }
>  
> right above the #endif /* APR_HAS_THREADS */ in apr_atomic.c.
> 
> it means we always get the function call overhead, but really, it's
> not like apr_atomic_init is going to be called more than once per
> program, so who really cares...
> 
> you'll have to be really careful though, since the platform specific
> #ifdefs are tricky and i don't think i could get them all right without
> having the machines available to test on...

Here's what I have so far. It's basically the same as what
you've described, except that I have an additional check to
make sure the apr_atomic_init() isn't already defined as a
macro.

Does this work on FreeBSD?

--Brian


Index: srclib/apr/atomic/unix/apr_atomic.c
===================================================================
RCS file: /home/cvs/apr/atomic/unix/apr_atomic.c,v
retrieving revision 1.15
diff -u -r1.15 apr_atomic.c
--- srclib/apr/atomic/unix/apr_atomic.c 22 Apr 2002 01:49:46 -0000      1.15
+++ srclib/apr/atomic/unix/apr_atomic.c 5 Jul 2002 21:03:22 -0000
@@ -153,5 +153,13 @@
 }
 #endif /* APR_ATOMIC_NEED_CAS_DEFAULT */
 
+#else /* !APR_HAS_THREADS */
+
+#if !defined(apr_atomic_init)
+apr_status_t apr_atomic_init(apr_pool_t *p)
+{
+    return APR_SUCCESS;
+}
+#endif /* !defined(apr_atomic_init) */
 
 #endif /* APR_HAS_THREADS */

Reply via email to