Test px

  • One thing is not very clear here (to me at least) -- It is clear that using the LOCK_EX flag no one will intervene while you are writing. But at what cost to them? What if one of your main concerns is success of that anyone else? Is it safe to assume the other thread will wait for the lock to be removed and succeed in their write? – Majid Fouladpour Feb 18 '14 at 21:34
  • 1
    flock is used for the locking. By default the function will block until the the lock is acquired, and since file_put_contents provides no way to specify anything else, I assume it will just block here too. – Jasper Feb 19 '14 at 1:07
  • 2
    And to clear things up: it is an advisory lock. Only when the other thread uses the same kind of locking will this work, and thus it's valid that someone calling this function (or something else based on the same locking system) will block (on this call). Anyone else not going through hoops to respect this lock will be able to ignore it entirely and won't magically have to wait or something like that. – Jasper Feb 19 '14 at 

Komentar