Generating One-Time URLs with PHP
Subject:   race condition
Date:   2002-12-10 06:32:36
From:   anonymous2
There's a nasty race condition between reading in the list of tokens and aquiring the lock. It's possible for a token to be added to the file before the lock is aquired, and this new token will not be written to the file in the loop.

The earlier comment about using files in a directory is an elegent solution that removes both the race condition and having to read the list of tokens into memory.