Hi all,
currently I run most of my APR based tools against valgrinds helgrind
tool to check for possible threading problems. Valgrind detected a
possible data race reading a allocator field:
static APR_INLINE
apr_memnode_t *allocator_alloc(apr_allocator_t *allocator, apr_size_t size)
{
....
/* First see if there are any nodes in the area we know
* our node will fit into.
*/
if (index <= allocator->max_index) {
^^^^^^^^^^^^^^^^^^^^^^^ Possible data race
#if APR_HAS_THREADS
if (allocator->mutex)
apr_thread_mutex_lock(allocator->mutex);
#endif /* APR_HAS_THREADS */
....
I think valgrind reports this error correctly since in multi-threaded
environments the lock needs to be acquired before the if()-block!
Any comments? Should I provide a patch?
Regards,
Stefan