Crashfix/FIRE-4090/FIRE-4820: Always create LLVolatileAPRPool so it can be safely used from different threads.

Nicky 2012-07-15 03:19:04 +02:00
parent 36e25cfb8a
commit fdb23cb0e8
1 changed files with 11 additions and 1 deletions

View File

@ -158,7 +158,17 @@ LLVolatileAPRPool::LLVolatileAPRPool(BOOL is_local, apr_pool_t *parent, apr_size
mMutexp(NULL)
{
//create mutex
if(!is_local) //not a local apr_pool, that is: shared by multiple threads.
// <FS:ND> Crashfix/FIRE-4090/FIRE-4820: is_local is default to TRUE. And of today (2012-07-15) all instances of LLVolatileAPRPool seem
// to be created just using this default argument.
// Using apr_os_thread_current and apr_os_thread_equal it appears that there are pools that get access from different threads nonetheless.
// This would explain why mNumActiveRef sometimes gets garbled.
// Resolution: Always use a mutex and give it a broader test is this helps.
// if(!is_local) //not a local apr_pool, that is: shared by multiple threads.
// </FS:ND>
{
apr_pool_create(&mMutexPool, NULL); // Create a pool for mutex
apr_thread_mutex_create(&mMutexp, APR_THREAD_MUTEX_UNNESTED, mMutexPool);