Search code examples
vb.netmultithreadingfilesystemwatcher

Will 2 File System Watchers work in different threads concurrently?


I have a service in vb.net and i am about to set another File system watcher. So i will have 2 in total. One fswatcher triggers when there is a change in a certain file.txt, and the other one triggers when there is a change in a directory.

Each trigger goes to a different code method. So they do not collide(they dont share the same methods in the app).

So my question is, Is every fswatcher running in a thread? So if i get two triggers will the code from fswatcher1 run in another thread than fswatcher2? Or will the one fswatcher wait for the other one to finish 1st?


Solution

  • Yes, though you can set the 'SynchronizingObject' property if you want enable locking mechanism between the two