apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: apr_file_lock on Windows
Date Mon, 05 Nov 2007 02:20:58 GMT
Marc Mongenet wrote:
> Hello,
> 
> In apr_file_lock documentation, it is written:
> "Locks are established on a per-thread/process basis;
> a second lock by the same thread will not block."
> 
> It works like that on Unix.
> But on Windows, a second call to apr_file_lock does block.
> 
> apr_file_lock(fd, APR_FLOCK_EXCLUSIVE);
> apr_file_lock(fd, APR_FLOCK_EXCLUSIVE); /* blocks on Windows */

Correct; the documentation is wrong, locks on files operate like APR_LOCK_DEFAULT,
whichever is optimal/implemented for the platform is their behavior.  If you must
have a mutex object with specific behavior, use a mutex.

Bill


Mime
View raw message