--- Juval Lowy <[EMAIL PROTECTED]> wrote: > [MethodImpl(MethodImplOptions.Synchronized)] > public void DoSomething() > { > /* Method code */ > }
My personal opinion is that this is a bit of a hack - it's place in the framework is in Interop rather than Threading. The documentation seems to imply that you shouldn't use it for synchronisation as a rule. IMHO C# should support the Java-esque syntax of : lock public void DoSomething() { } > So the compiler does not just plant code. > Could it be that the .NET runtime merely locks and unlocks before and after > the method, without exception handling? It places an attribute on the method which the runtime uses to place a lock. Java does the same. Thing is, because you can't see what exactly the runtime is doing, it is open to interpretation. MS needs to nail this down IMHO. If it a valid general purpose synchronisation technique then they need to say so. Peter __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.