apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Ruppert ...@ruppert-it.de>
Subject Re: apr_file_close()/apr_socket_close()
Date Fri, 30 Oct 2009 11:01:47 GMT
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/dev@httpd.apache.org/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 

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!


View raw message