httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kew <n...@webthing.com>
Subject Re: APR and mutexes ?
Date Thu, 13 Jan 2005 21:32:24 GMT
On Thu, 13 Jan 2005, Xavier Beaudouin wrote:

> I have inside a Apache2 module a call to a non thread safe function. I
> need then to do :
>
> mutex_set();
> call_to_non_thread_safe();
> unset_mutex();
>
> Now I can do that using POSIX calls, but I really like to use APR calls.

Yep.  That's right for a module.  But there's a bit more than that:
to work across all platforms you need

#if APR_HAS_THREADS
   apr_thread_mutex_dosomething(...) ;
#endif

> Is there any good doc or even an example module I can use to make such
> work ?

The doc is in /usr/local/apache/include (or wherever you put your headers).

I recently dealt with this in the apr_dbd package -
see http://www.apache.org/~niq/dbd.html

BTW, doesn't anyone else think it's wrong for apps to have to faff
around with #ifdefs, when it would be trivial for apr_thread_mutex.h
to #define all the functions out when not APR_HAS_THREADS?

BTW2, this looks more appropriate to the modules list than here.

-- 
Nick Kew

Mime
View raw message