Static method thread safety?
C#
2
Posts
2
Posters
0
Views
1
Watching
-
Hi folks, Do I need to use the [MethodImpl(MethodImplOptions.Synchronized)] attribute on statis methods, or are they implicitly thread-safe? Thanks in advance. Dr Herbie Remember, half the people out there have below average IQs.
Static methods are like normal methods with respect to thread safety. You do need to protect them with some kind of synchronization mechanism.. By the way, are you sure you'd want to the use the MethodImpl attribute for synchronization? AFAIK, all methods with that attribute share a single lock, so if one thread is executing one method, no other thread will be able to execute *any* method with that attribute. Regards Senthil _____________________________ My Blog | My Articles | WinMacro