Support passing a block to lock