Traditionally, this is done with a boolean column locked in a database record that is marked accordingly.
This is a blocking function, which the lock should be released, and circumstances can prevent this in a natural way (system crashes, stupid user, dropped network packets, etc., etc., etc., etc.). That's why you will need to provide a manual unlock method and / or set a time limit (perhaps with a cron job?) On how long the recording can be locked. Could you do some kind of AJAX poll to keep the record locked if the browser is still open? In any case, it is probably best to verify that the data in the record is the same as when the lock was acquired before you changed it.
This limitation of this type of behavior is especially common in web applications, but true for anything that uses this approach. Sage Line 50, for one, is a mistake for him, I regularly delete lock files after the machine / application crashes.
source share