Skip to content

Latest commit

 

History

History
9 lines (5 loc) · 585 Bytes

PH_B004.md

File metadata and controls

9 lines (5 loc) · 585 Bytes

PH_B004 - Single Pulse for Variable Wait Conditions

Problem

The invocation of Monitor.Pulse(...) notifies a Monitor.Wait(...) that is enclosed by a while loop that depends on a method parameter. Due to the parameter dependence of the while loop, there can be multiple threads with semantically different conditions. Because of the reason that it is not possible to signal a specific thread, it may lead to the signalization of the wrong one.

Solution

Replace the invocation of Monitor.Pulse(...) with Monitor.PulseAll(...) to always signal all waiting threads.