MSDN documents the thread-safety of instances members of BCL types pretty well, but I have never really seen information indicating how the Dispose
method of IDisposable
types can be called.
Is the Dispose
method a) guaranteed to be thread-safe for all classes, b) never guaranteed to be thread-safe, c) guaranteed to be thread-safe for some classes (if so, where is this specifically documented)?
Finally, if the Dispose
method is guaranteed to be thread-safe, does that mean I have to put a lock around each instance method in the class that uses disposable resources?
Side point: I'm aware that finalizers for types ought to be thread-safe due to the way garbage collection works in .NET (quite aggressively), and they may potentially call the Dispose
method. However, let's leave this issue aside for the point here.