apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mladen Turk <mt...@apache.org>
Subject Re: Failing apr_pool_create in case apr_pools_initialized == 0
Date Tue, 11 Dec 2007 19:29:50 GMT
Sander Striker wrote:
> After apr_terminate() when calling any function, the behaviour is undefined.
> This is as expected.  I don't see a need to protect against that.

Sure, but the same logic can then be applied to
the 'if (apr_initialized++)'
Seems we after all honor multiple invocations of
both apr_initialize/apr_terminate, etc.

Threaded applications might be unaware that other
thread called apr_terminate and that this call will
actually cause the apr to terminate.
So since one cannot be sure that the call to the
apr_terminate() will terminate the apr, application
using apr will need to duplicate the logic in
apr_initialize/apr_terminate for assuring it'a a singleton
and at which time it is safe to call the apr_pool_create,
and in which it is not.

Anyhow, it's a simple compare against an int, so
a completely benign operation, but allowing to
not core dump in threaded environment.


View raw message