- I have a thread which is responsible for scheduled transferring of files.
- The files transferring schedule is mentioned in an XML file, which can be changed by the user at any time.
- I have created a
FileSystemWatcher
, which is responsible to keep watching the XML file and notify if there is any change in the XML file (so that we can get the new schedule value). ThisFileSystemWatcher
notifies by setting aAutoResetEvent
called_waitTillXmlChanges
.
Question: Once a scheduled file transferring is done, I want to put that thread into Waiting state until one of the following two conditions is met:
(a). Either the next file transfer schedule date is reached
(b). OR the FileSystemWatcher
has notified about a change in the .XML file
How can I make my file transferring thread waiting for above two conditions (two AutoResetEvent
waiting) and proceed if anyone of them is Set()
?