You are here: Re: Two simultaneous write accesses to a text file « PHP Programming Language « IT news, forums, messages
Re: Two simultaneous write accesses to a text file

Posted by Kimmo Laine on 03/09/07 12:34

"Rik" <luiheidsgoeroe@hotmail.com> wrote in message
news:op.towf9zt1qnv3q9@misant...
> Colin McKinnon
> <colin.thisisnotmysurname@ntlworld.deletemeunlessURaBot.com> wrote:
>> andy.z@blueyonder.com wrote:
>>
>>>
>>> If 2 people try to access the same text file at the same time to write
>>> to
>>> it - what happens in PHP ?
>>>
>>
>>
>> What happens when you test it, Andy?
>
> I agree there should be some testing involved. However, how do you propose
> to test it? Writing is often very fast and tricky to time so that 2
> processen write simultaniously in a verifiable way...


Should be actually quite trivial using sleep. In pseudo code:

open handle to file x
write to filehandle current time
wait 10 seconds
write to filehandle current time
close file handle

this code run simultaneously using two browsers should demonstrate the case
of collision and the effects of it.

--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti pδivittyvδ nettisarjis
spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg)

 

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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация