|
Posted by Andy Hassall on 09/24/06 13:14
On 23 Sep 2006 09:46:38 -0700, "NC" <nc@iname.com> wrote:
>Andy Hassall wrote:
>>
>> > $fp = fopen($file, 'w');
>>
>> Although the fun then begins when you hit the (admittedly
>> short-duration) race condition here...
>
>You are absolutely right, but how else could you work around the file
>locking issue on Windows?
Not sure whether there's anything convenient in PHP itself that'll give you a
per-thread reliable and atomic lock. The win32 API has plenty of
synchronisation functions that would work, perhaps one could be called using
the win32api extension?
In some situations where I've needed locks and have had to work across Windows
and NFS filesystems (which have their own file locking quirks) I've used locks
within a database (user-defined locks in Oracle) - but in those cases I was
connecting to a database already.
--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Navigation:
[Reply to this message]
|