apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@apache.org>
Subject RE: [PATCH] Support APR_APPEND (O_APPEND) with apr_file_write on Windows
Date Sat, 26 Oct 2002 15:56:39 GMT
At 01:30 PM 10/25/2002, Bill Stoddard wrote:

>>
>> You can't flock SHARED... that denies everyone (including yourself)
>> write access to the file.  Please review the FileLockEx docs.
>>
>
>I did. APR_FLOCK_EXCLUSIVE maps to LOCKFILE_EXCLUSIVE_LOCK which locks out
>all reads and writes. APR_FLOCK_SHARED is what you are calling
>APR_FLOCK_WRITE (which does not exist) and allows multiple readers but only one writer.

Hadn't looked at this...

    flags = ((type & APR_FLOCK_NONBLOCK) ? LOCKFILE_FAIL_IMMEDIATELY : 0)
          + (((type & APR_FLOCK_TYPEMASK) == APR_FLOCK_SHARED) 
                                       ? 0 : LOCKFILE_EXCLUSIVE_LOCK);

doesn't trigger 'LOCKFILE_SHARED_LOCK' at all.  Wish we had used
the 'reader/writer' paradigm from reader writer locks :-)

Your code does end up with a 'write' lock, shared read, not a shared
read lock :-)

Bill


Mime
View raw message