Guarded lock example