C
CKKwan
Dear All,
[Synchronization]
Can synchronize a class, any function is called and the entire class
is locked.
[MethodImplAttribute(MethodImplOptions.Synchronized)]
Can synchronize a method
What if I need to Lock a class only when specific method is call?
For Example:
public class C
{
public void A() {}
public void B() {}
}
The instance of class C need to be locked when method B() is called,
but not lock when method A() is called.
Certainly I can manually put 'lock(this)' in method B(). But is there
any other way of doing this?
Thanks in advance
[Synchronization]
Can synchronize a class, any function is called and the entire class
is locked.
[MethodImplAttribute(MethodImplOptions.Synchronized)]
Can synchronize a method
What if I need to Lock a class only when specific method is call?
For Example:
public class C
{
public void A() {}
public void B() {}
}
The instance of class C need to be locked when method B() is called,
but not lock when method A() is called.
Certainly I can manually put 'lock(this)' in method B(). But is there
any other way of doing this?
Thanks in advance