You are here: Re: flock won't non-block at all « PHP Programming Language « IT news, forums, messages
Re: flock won't non-block at all

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация