On Mon, Sep 09, 2002 at 12:02:02PM -0700, Brian Pane wrote:
> Dave Hill wrote:
> 
> >Hi all,
> >     While digging into that mysterious hang of Apache 2 on Tru64,
> >I found that it seemed to be hanging under apr_poll in alloca() 
> >While I found that the problem seems to go away when not using a
> >prerelease version of the OS, it did bring something to my attention.
> >
> >According to "Those Who Know", in a threaded environment on Tru64, we
> >should be including alloca.h which causes the alloca() function to
> >become a builtin (which They say is the one true way of avoiding
> >threaded issues). This affects one (yes 1) file in the pool,
> >srclib/apr/poll/unix/poll.c. Attached is a suggested change to include
> >alloca.h if HAVE_ALLOCA is set. If my assumption is wrong that alloca
> >is a universal include file (for machines that have alloca), then this
> >could be restricted to Tru64, or maybe another conditional in 
> >configure :-p
> >
> 
> I like the idea of restricting the change to Tru64 for now, just
> to eliminate the possibility of breaking something unexpected on
> some other system this close to the 2.0.41 launch.  Is there a
> standard preprocessor macro that compilers on Tru64 define, so
> that we can do something like "#if HAVE_ALLOCA && __TRU64__"?

Bison does something similar to:
  #if defined _AIX && !defined __GNUC__
   #pragma alloca
  #endif

  #include <config.h>

  /* Make alloca work the best possible way.  */
  #ifdef __GNUC__
  #define alloca __builtin_alloca
  #else /* not __GNUC__ */
  #if HAVE_ALLOCA_H
  #include <alloca.h>
  #else /* not __GNUC__ or HAVE_ALLOCA_H */
  #ifndef _AIX /* Already did AIX, up at the top.  */
  char *alloca ();
  #endif /* not _AIX */
  #endif /* not HAVE_ALLOCA_H */
  #endif /* not __GNUC__ */

This seems quite robust.

-- 
albert chin ([EMAIL PROTECTED])

Reply via email to