How can we know File/Folder is using some other process or program RRS feed

  • Question

  • Hi
    How can we know folder is using some other program or thread?

    what if happen if two different threads are trying to deleting same folder recursively  at the same time.

    how can we know folder is using or deleting some other thread before try to delete that?

    how can we handle this situation

    anybody help me


    Friday, December 18, 2009 12:36 AM


  • If one thread deletes the folder, other thread should get 'DirectoryNotFoundException'. Which you can handle using Try-Catch blocks.

    but on multi core processors, it still can happen that both threads strike at the same time. I guess you cant avoid that. Synchronization attribute is designed for that but there you have to make your own class then.

    If you're using threads, why not take care that both threads have respective boundaries ? as in, what if you assign different roots to different threads, by this way a thread will not poke in to other thread's area. Just a suggestion..


    My BlogMy FacebookYOUR Place to have fun time ! Awesome RPG Action Game
    • Marked as answer by Jeff Shan Tuesday, December 22, 2009 8:11 AM
    Friday, December 18, 2009 6:48 AM