I plan to use the Auto reset Event Handle to communicate between threads.
EventWaitHandle handle = new EventWaitHandle(false, EventResetMode.AutoReset);
My producer thread code looks below
produceSomething(); handle.Set();
In the consumer stream, I have to load data every minute or when the producer is called the Set method
try { while(true) { handle.WaitOne(60000, false); doSomething(); // Downloads data from Internet. // Takes lot of time to complete it. } } catch(ThreadAbortException) { cleanup(); }
My question is, doSomething consumer thread and producer call set function work, what will the state of the reset object of the <object be? >
My requirement, as soon as the calling method calls the call, I need to download the latest data from the Internet. If the doSomething function doSomething started when Producer calls the dialing method, I have to abort it and call again.
user209293
source share