Hello,
I am planning to use Auto reset Event Handle for Inter Thread communication.
EventWaitHandle handle = new EventWaitHandle(false, EventResetMode.AutoReset);
My producer thread code look like below
produceSomething();
handle.Set();
In the consumer thread, I have to download data for every one minute or when prodcuer
is called 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 if consumer thread is running doSomething funtion and producer calls set function, what would be state of Auto reset event object?
My requreiment is as soon as producer calls set method i have to downlaod fresh data from intenet . If doSomething function is running, when Producer calls set method, i have to interrupt it and call again.
Any help is appreciated.
Regards
Raju