Locking of code

Låst objekter for at sikre mod deadlocks