G
Guest
Hello -
My question involves using a FileSystemWatcher class within threads in a
process. I am starting multiple threads, and launching a method I called
"Start" for each; within each thread, I want to monitor a directory for new
files, using FileSystemWatcher. The OnCreate handler for the FSW will then
process the file. The code works, but the OnCreate handlers are NOT
independent of each other - if the processing of one file takes 30 seconds,
the processing of another file in a different directory doesn't start until
the first one is done. It seems that the OnCreate handler code is not
running on the same thread that I "Start"ed, and where the FSW class was
instantiated. Instead, it seems that all of the OnCreate handler code
instances are running on the same thread (hence the blocking problem). Is
there a way around this? I really need each thread and its OnCreate handler
code to be independent of each other.
Thanks in advance.
My question involves using a FileSystemWatcher class within threads in a
process. I am starting multiple threads, and launching a method I called
"Start" for each; within each thread, I want to monitor a directory for new
files, using FileSystemWatcher. The OnCreate handler for the FSW will then
process the file. The code works, but the OnCreate handlers are NOT
independent of each other - if the processing of one file takes 30 seconds,
the processing of another file in a different directory doesn't start until
the first one is done. It seems that the OnCreate handler code is not
running on the same thread that I "Start"ed, and where the FSW class was
instantiated. Instead, it seems that all of the OnCreate handler code
instances are running on the same thread (hence the blocking problem). Is
there a way around this? I really need each thread and its OnCreate handler
code to be independent of each other.
Thanks in advance.