Skip to content

Latest commit

 

History

History
9 lines (5 loc) · 370 Bytes

PH_P006.md

File metadata and controls

9 lines (5 loc) · 370 Bytes

PH_P006 - Discouraged Monitor Method

Problem

The explicit use of the method Monitor.Enter(object) is discouraged. Moreover, the correct implementation of a fail-safe monitor-lock is cumbersome and requires unnecessary boilerplate code.

Solution

Use the provided lock statement instead. This statement ensures correct acquisition and release of the lock.