Content locking module for Drupal 7
This is already built-in in Drupal 6 and 7, in the function node_validate.

The relevant piece of code is reproduced below:

if (isset($node-&gt;nid) &amp;&amp; (node_last_changed($node-&gt;nid) &gt; $node-&gt;changed)) {
  form_set_error('changed', t('This content has been modified by another user, changes cannot be saved.'));
}


It doesn't lock anything, but it shows the second editor a message, and prevents the second editor from saving and thereby overwriting what the first has done. The second editor can then copy-paste his/her efforts to Notepad or other temporary buffer, reload a fresh version of the node (i.e. a version that contains the first editor edits), add his stuff again, and save.

This warning message serves the same purpose as locking, but IMHO it does it better and less prone to deadlocks.

The problem with an outright lock is that users may open a node edit page but don't actually do any edits.  If they just abandon it (i.e. don't press "Save") it will remain in that state until reset.  Doing it on save is better because it avoids the deadlock situations that may arise from locking something the user may abandon.