I have a program that should keep watching events that come from an outside source (FileSystemWatcher
), and the source needs my handling code to be fast, or I could lose the next events.
But at anytime my program might be executing a heavy operation.
First question:
If an outside event is raised during a heavy operation, will my program finish the operation before handling the event?
Second question:
I'm a newbie to Threading, so my main question is how can I create a separate permanent thread to do only
the event handlings from the outside source?
My first approach is that this thread will simply store the data to be accessed by the main code when it's ready for that, and use the heavy coding to handle the stored data.
Thank you.