Salesforce interview question

How would you implement a read/write lock for a table in a database?