You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Gregory Nicholls <gn...@bellsouth.net> on 2007/03/14 17:42:01 UTC

apr_file_lock on WIN32 - possible bug ?

 Hi,
    My understanding of apr_file_lock() says that a second lock for the 
same process will not suspend.
I opened a new file on WIN32 with the following:
 apr_file_open(fd,APR_FOPEN_BINARY|APR_FOPENREAD|APR_FOPEN_WRITE|APR_FOPEN_APPEND|APR_FOPEN_CREATE,APR_OS_DEFAULT,pool);

Next I locked it with apr_file_lock(fd,APR_FLOCK_EXCLUSIVE);

An attempt to write to the file with 
apr_file_write_full(fd,ptr,len,&written); suspended.

 Looking in the apr code for file_write_full, it also grabs an exclusive 
lock.
A quick test with 2 successive calls to 
apr_file_lock(fd,APR_FLOCK_EXCLUSIVE) shows the same behaviour, the 
second lock suspends.
    Have I misunderstood something or is there a bug here ?
          Thanks,
             Greg.