In MSDN documentation we see :
Console
Thread Safety
This type is thread safe.
TextWriter
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
I've developed a similar (static) class to the Console one, so how can I tag it to thread safe? I'm extracting XML documentation and I would know how I can this part like in the MSDN Doc'.
Hope I'm clear enough...
Thanks for help !
To test if the combination of two methods, a and b, is thread-safe, call them from two different threads. Put the complete test in a while loop iterating over all thread interleavings with the help from the class AllInterleavings from vmlens. Test if the result is either an after b or b after a.
To make these classes thread-safe, you must prevent concurrent access to the internal state of an instance by more than one thread. Because Java was designed with threads in mind, the language provides the synchronized modifier, which does just that.
Using Atomic Variable Using an atomic variable is another way to achieve thread-safety in java. When variables are shared by multiple threads, the atomic variable ensures that threads don't crash into each other.
The Sandcastle Help File Builder project contains a useful XML Comments Guide.
It documents the threadsafety
tag:
<threadsafety static="true|false" instance="true|false"/>
The root SHFB documentation page is here.
Add this detail to the <summary>
or <remarks>
tags.
There is no specific tag or convention on how to indicate a class is thread safe - you need to write it in your documentation.
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