Reply to Re: question about using lock files

Your name:

Reply:


Posted by Sjoerd on 05/04/06 19:30

William Gill wrote:
> To prevent two users from
> getting the same serial number I put a delay loop in the script using
> while(file_exists(tracknum.lock)

You have a typical race condition:

You wait until the file is deleted and then create it. Suppose that the
file is deleted and created immediatly after file_exists. The file
would be created by another process, e.g. another user requesting this
page. After the while() loop, you assume that the file still does not
exist in the next instruction, which is an unfair assumption.

[Back to original 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

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