S
Sateesh
Hi,
I have a method that is being called by a timer. I want to lock the entire
section of the code in the method to protect it from being called
simultaneously. So I am using Monitor.Enter(this) and Monitor.Exit(this)
where this is the form object where the method is present.
But what I observed was even after this lock still I see multiple calls
accessing the code. Am I doing something wrong? Is it the way to block a
section of a code in .Net?
Thanks in advance,
Sateesh.
I have a method that is being called by a timer. I want to lock the entire
section of the code in the method to protect it from being called
simultaneously. So I am using Monitor.Enter(this) and Monitor.Exit(this)
where this is the form object where the method is present.
But what I observed was even after this lock still I see multiple calls
accessing the code. Am I doing something wrong? Is it the way to block a
section of a code in .Net?
Thanks in advance,
Sateesh.