Re: synchronous call
- From: Ivan <ivan.rachev@xxxxxxxxxxxxxxxxxxx>
- Date: Wed, 14 Dec 2005 16:54:32 -0500
> Again, you didn't show anything that you were trying to synchronize, so ... synchronized code is substituted for simplicity by A.func() this is code that only one thread needs to be in. if I make it static and use this attribute (thanks for the attribute), my problem's fixed.
example:
using System.Runtime.CompilerServices;
class A
{
[MethodImplAttribute(MethodImplOptions.Synchronized)]
public static void func() {}
}thread1: A a1 = new A(); a1.func();
thread2: A a2 = new A(); a2.func();
Ivan
Nicholas Paldino [.NET/C# MVP] wrote:
Ivan,
Check out the MethodImpl attribute, and pass in the MethodImplOptions.Synchronized value to the attribute.
However, this will make any call on the object (you need to apply it to every method) hold whenever any other method is called on any other thread.
.
- References:
- synchronous call
- From: Ivan
- Re: synchronous call
- From: Nicholas Paldino [.NET/C# MVP]
- Re: synchronous call
- From: Ivan
- Re: synchronous call
- From: Nicholas Paldino [.NET/C# MVP]
- synchronous call
- Prev by Date: RE: Encryption for a log and Unicode Characters...? Yikes!
- Next by Date: Testing for 2.0
- Previous by thread: Re: synchronous call
- Next by thread: bind GUI elements to xml
- Index(es):