>What I've got is something like this
>
>SET REPROCESS TO AUTOMATIC
>SELECT NextRef
>=FLOCK()
>Read the number
>increment the number
>write it back
>unlock
>
>Am I right in thinking that with reprocess set to automatic the flock() function will attempt over and over again to lock the file until a successful lock is placed? In which case it the code below the call to flock() will never be executed unless the file is locked.
Generally, yes. But now be careful;
Once the Esc button is in effect, and the user can press escape, the FLOCK() attempts will stop. And then the code continues ...
Look at this help snippet too :
Note If FLOCK( ) fails to lock a table, it returns false (.F.) and does not generate an error. As a result, you can’t use FLOCK( ) to trigger an ON ERROR routine.This would happen at Esc (when allowed), and you really should be coding like this :
SELECT NextRef
IF NOT FLOCK()
RETURN 'Failed'
ELSE
Read the number
increment the number
write it back
unlock
RETURN 'Succeeded'
ENDIF
HTH,
Peter