apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <jwool...@virginia.edu>
Subject Re: apr_psprintf thread safe?
Date Fri, 09 Jan 2004 03:50:40 GMT
On Thu, 8 Jan 2004, Donald Doane wrote:

> The following comment is from apr_lib.h:
>
>  * apr_vformatter does not call out to any other code, it is entirely
>  * self-contained.  This allows the callers to do things which are
>  * otherwise "unsafe".  For example, apr_psprintf uses the "scratch"
>  * space at the unallocated end of a block, and doesn't actually
>  * complete the allocation until apr_vformatter returns.  apr_psprintf
>  * would be completely broken if apr_vformatter were to call anything
>  * that used a apr_pool_t.  Similarly http_bprintf() uses the "scratch"
>  * space at the end of its output buffer, and doesn't actually note
>  * that the space is in use until it either has to flush the buffer
>  * or until apr_vformatter returns.

That seems to say to me that apr_psprintf is in fact threadsafe after all.
:-)

--Cliff

Mime
View raw message