Bojan Smojver wrote:
On Fri, 2009-10-30 at 10:26 +0100, Stefan Ruppert wrote:
first of all the question is if the apr_file_t handle can be safely
used from different threads? e.g. is APR file wrapper thread safe? And
I don't think so!

It isn't safe. Not even with APR_FOPEN_XTHREAD.

This whole thing is related to this:

http://www.mail-archive.com/[email protected]/msg46051.html

I don't know the concept behind APR_FOPEN_XTHREAD, but after a quick look into the trunk source code this seems to only protect the buffered io but not the file structure itself.

From my point of view if an application needs to handle a file within different threads it has to protect its multi-threaded usage with an own lock!

However, if you want to be sure use valgrind/helgrind to detect any threading race conditions. I have found a race condition with helgrind in apr_pools.c! See my post from august. This tool is incredible!

Stefan

Reply via email to