Jump to content

DonCoder

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Everything posted by DonCoder

  1. Do race conditions usually exist when writing OR appending to an existing file? $f1 = fopen($filename1, 'r+'); $f2 = fopen($filename2, 'a'); flock($f1, LOCK_EX); flock($f2, LOCK_EX); fwrite($f1, 'foo'); fwrite($f2, 'foo'); flock($f1, LOCK_UN); flock($f2, LOCK_UN); fclose($f1); fclose($f2); What would happen if this code ran at the exact same time? Is there a chance that the data could be corrupted in the aforementioned code example?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.