... { lock $variable; $x = something } ...