apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@tuxteam.de
Subject Questions about apr_initialize(), apr_terminate()
Date Tue, 12 Oct 2010 10:45:31 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

We are trying to use libapr from an extension (it's a libxslt extension
function, to be more precise). The whole thing will be used sometimes as
an Apache module, but sometimes from a stand-alone app.

So in the first case (Apache module), apr will be initialized when it
arrives at our extension (which is basically a callback called from a
library), but in the second case (stand-alone) it won't.

Looking into the source, it seems that apr_initialize() just increments
a counter (doing the initialization the first time, i.e. when the
counter is zero). Likewise, apr_terminate() decrements the counter,
tearing things down when it reaches zero, in a stack-like fashion.

Thus, it would seem safe to call apr_initialize from each extension -
I'd just have to make sure that the calls are balanced. Is that right?

Another question: what is the difference between apr_terminate() and
apr_terminate2()? I didn't understand the remark in the docs [1]

Thanks for any pointers/insights

[1] <http://apr.apache.org/docs/apr/1.4/group__apr__library.html>

- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFMtDxLBcgs9XrR2kYRAmGgAJ9m9ojB9EYNQJy5/+WgLtTDpXnV8gCcC9qh
wRwID8aJAUYLog3wRHkIerc=
=J1Ak
-----END PGP SIGNATURE-----

Mime
View raw message