You can use a semaphore file.
In reply to Re^4: Populating A Hash by fglock in thread Populating A Hash by dReKurCe