i'm trying to figure with the best method to deal multiple class to a method that use a blocking resource.
The goal:
permit the multiple calls to a method that use a DataReader
. While this first call is in progress, Keeping the rest to calls (if present) on hold until the method ends.
When the this method finish it's execution, i need to discard every request accumuled while the first execution was in progress, only permitting that the last request execute.
In specific i'm dealing with repeated event firing in a Windows.Forms
object that call a DataReader
that doesn't finish to execute and the next call that comes behind it raises an exception.
Any ideas to design this part ?