Hi,
I have a "client process" runing in one thread , and more threads, that
are accessing different data that are provided by "client process". I am
considering making a "client process" as static class, so that data
would be easily accessible by any thread (read only).
Do I have to use thread locking ? What would be the best practice to share (provide) data to another threads?
Loading
Jaganathan BantheswaranPosted Nov 18, 2013, 5:14 AM
No.
You don't need your locking as the static constructor makes sure to run only once per instantiated type.
If the member which you are sharing is writable then you should have proper Locking.