When I look through sample implementations of IDisposable
, I have not found any that are threadsafe. Why is IDisposable
not implemented for thread safety? (Instead callers have a responsibility to make sure only a single thread calls Dispose()
).
You should not dispose of an object until you have finished with it. If there are other threads referencing the object and there is a chance they might want to call its methods, you should not be disposing of it.
Therefore it is not neccessary for Dispose to be thread safe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With