Should look at the "lock" statement.