apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florian Weimer ...@deneb.enyo.de>
Subject Re: thread safety of apr_initialize
Date Fri, 27 Sep 2013 10:29:49 GMT
* Branko ─îibej:

> If the application that uses your library also uses APR directly, it's
> already responsible for initializing it in a single-threaded context. If
> it doesn't, it's reasonable to require the app to call your library's
> init function, which you can easily protect with a spinlock (that you
> can implement using APR's atomic functions).

It's still problematic if you've got multiple libraries which use APR
internally (without exposing it) and perform some form of lazy

Pushing initialization sequencing to the application is really bad,
and it's totally unnecessary on modern systems which always provide
mutexes, even to single-threaded processes (where they are no-ops).

View raw message