TROY.LIU 劉春偉 <troy....@deltaww.com.cn> writes: > In our practice, we found two threads get same address returned by > apr_palloc. It will happen about one hour later after our server > starts. We are using apr 1.4.5, the issue still exists in the > latest subversion.
>From apr_pools.h: * Note that most operations on pools are not thread-safe: a single pool * should only be accessed by a single thread at any given time. The one * exception to this rule is creating a subpool of a given pool: one or more * threads can safely create subpools at the same time that another thread * accesses the parent pool. The pool system allows multiple threads to use multiple pools. There is no point trying to make apr_palloc "thread-safe" as the API is not designed to work that way. Even if apr_palloc was "thread-safe" how would apr_pool_clear work? A related discussion: http://mail-archives.apache.org/mod_mbox/apr-dev/201304.mbox/%3c792240597.462741.1366211671567.javamail.r...@brainsware.org%3E -- Philip