Reply to Re: [PHP] Array_merge, safety and race condition?

Your name:

Reply:


Posted by "Richard Lynch" on 11/11/05 19:53

On Thu, November 10, 2005 6:44 pm, Ezra Nugroho wrote:
> $array1 = array_merge ($array1, $array2);
>
> So far the code gives me what I want. However, suppose if $array1 is
> extremely huge, am I introducing a bug here because of possible race
> condition? It's possible that array_merge has two write something to
> $array1 (left hand side) before it even finishes reading it (argument)
> in the first place. Let alone merging the two.

The assignment operator (=) computes the right-hand side completely
before putting its value in the left-hand side.

Your large arrays might get dumped to swap on the hard drive and burn
pits into the platters, and they might thrash the CPU until it catches
on fire, but there's no race condition in this statement.

--
Like Music?
http://l-i-e.com/artists.htm

[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

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