B
brett
What exactly is the parameter passed to a thread monitor used for?
For example, I might do this:
private Object Protect1 = new object();
Monitor.Enter(this.Protect1);
try
{
myarray[j].Delete();
}
finally
{
Monitor.Enter(this.Protect1);
}
The Protect1 parameter has nothing to do with my logic. Yet if I leave
it out, I get this error:
No overload for method 'Enter' takes '0' arguments
Is the parameter just the name of my code block? Meaning, what ever I
have in the enter part must correspond with what I have in the exit
part?
Thanks,
Brett
For example, I might do this:
private Object Protect1 = new object();
Monitor.Enter(this.Protect1);
try
{
myarray[j].Delete();
}
finally
{
Monitor.Enter(this.Protect1);
}
The Protect1 parameter has nothing to do with my logic. Yet if I leave
it out, I get this error:
No overload for method 'Enter' takes '0' arguments
Is the parameter just the name of my code block? Meaning, what ever I
have in the enter part must correspond with what I have in the exit
part?
Thanks,
Brett