As I am working on multi-threaded
application (.Net Windows service
) with .Net, I need to make sure the following things.
- I am calling each task (business scenarios) on each different thread with
Delegate BeginInvoke
patterns. (Which means that ainstance method of new object
I am calling with each different thread initeration of loop
for 1000 clients) - I have one scenario in the application that, for the first time (When my window service starts), I want to set flag somewhere in the application. (May be by C# static fields)
- I want to make sure that, once the first thread Update the value (of static field), then all other rest of the thread MUST only use the last value which is set by 1st thread.
So, basically, I want to update the value (of C# static field
) for the first time only (When my windows service start), and want my all other thread should use the latest value set by first thread
.
So, I want to update the value ONLY ONCE, then rest other thread should
use only that value.
Would anybody please tell me that How would I achieve this?
Thanks in advance!