Satsuma
a delicious .NET graph library
|
A type is called thread safe if its instances can be simultaneously operated on by multiple threads without compromising integrity.
For example, a class is thread safe if its methods and properties behave correctly even if multiple threads call/access them at once.
The following rules apply for types defined in Satsuma, concerning thread safety:
The thread safety of an interface is in fact a restriction on implementor classes. In a sense, thread safety is part of the interface definition. For example, if ISomething
is thread safe, then this means that all implementors should be written in a way that ISomething
instances can be used by multiple threads at once.
IReadOnlySomething
is a thread safe interface.WritableSomething
, which implements IReadOnlySomething
, may not be thread safe, as the data structure may be compromised if it is modified concurrently.IReadOnlySomething
methods are called, then a WritableSomething
instance should be freely usable by any number of threads.