On Dec 23, 2011, at 5:52 AM, Steve Cassidy wrote:

> Obviously, you need some refinements to this, such as to prevent the loop 
> continuing for ever. But that's the basic principle.

One refinement is that entering a field is no longer sufficient to lock a 
record. You should use the Open Record[] command to do so, which should return 
error 301 if the record is in use.

> Back in the day, I and others tested this with scripts that created thousands 
> of serial-numbered records running concurrently on multiple machines. I never 
> saw a duplicate. Eric Scheid, who hosts the Filemaker Experts mailing list, 
> concurred that this method was reliable. In my book, approval by Eric means 
> it must be pretty bomb-proof....

What you've described is what's known as a "race condition" and you are 
proposing use of a lock to address it. The particular way you've addressed it 
is called "test and set lock" using FMP's record locking as a way to do it 
atomically.


Cheers,
-corn


Cornelius Walker
The Proof Group
http://proofgroup.com/

Reply via email to