J
Joannes Vermorel
I am currently dealing with a multithreaded application. Basically, I have
the following class:
class MyClass {
public void Foo1() {
// do something (no method call)
lock(this) { /* do something (no method call) */ }
}
[MethodImpl(MethodImplOptions.Synchronized)]
public void Foo2() {
// do something (no method call)
}
}
And with 2 threads, I manage to get a deadlock between calls to Foo1() and
Foo2(). My guess (but I may be wrong) is that somehow MethodImpl is also
taking a lock on the MyClass instance. A quick view at MSDN did not tell if
such guess was true or not.
Can anyone confirm or refute the guess ?
Thanks,
Joannes
the following class:
class MyClass {
public void Foo1() {
// do something (no method call)
lock(this) { /* do something (no method call) */ }
}
[MethodImpl(MethodImplOptions.Synchronized)]
public void Foo2() {
// do something (no method call)
}
}
And with 2 threads, I manage to get a deadlock between calls to Foo1() and
Foo2(). My guess (but I may be wrong) is that somehow MethodImpl is also
taking a lock on the MyClass instance. A quick view at MSDN did not tell if
such guess was true or not.
Can anyone confirm or refute the guess ?
Thanks,
Joannes