How to Stop a Running Thread

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wolfenstein
    New Member
    • Mar 2008
    • 25

    How to Stop a Running Thread

    Hi;
    I have posted a similar post about a File Copy process that is multi-threaded where each thread is doing their part; i.e. copying then verifying etc.

    Now i need some help how to stop my service/application as some threads are already running and some files are in process; so when i just close my application then that can result into some partial copy/move.

    I'm looking for a way to stop my application that first completes the in process files then exit. (It can be abnormal termination)
    Please suggest!
  • wolfenstein
    New Member
    • Mar 2008
    • 25

    #2
    No suggestion, NO reply at all :(

    Comment

    • Mr Gray
      New Member
      • Apr 2008
      • 47

      #3
      How are you implementing this? I have a multi thread app that basically reads a db table that has 'jobs' to run and loads only 2 at a time in a delegate that fires-and-forgets.

      This way you app can queue up the 'jobs' and have a service/app of some kind read from the queue and execute each job one after the other.

      If the process is not complete the row will still remain in the db table otherwise the 'job' is removed from the table.

      Comment

      • wolfenstein
        New Member
        • Mar 2008
        • 25

        #4
        In my case; i almost get the same information from DB but actually my application performs the Copy/Move of files from one location to another.

        Now my concern is if the service is stopped or terminated then some files may be in progress and can be corrupted. I want to secure the files basically that in any case my files wont be affected during the termination or in any scenario.

        Comment

        • Mr Gray
          New Member
          • Apr 2008
          • 47

          #5
          Is it possible for you to do a dos copy if the files are on disc? Then unless the machine actually has the plug pulled the files will be copied and you will not have any corruption problems.

          Comment

          • Mr Gray
            New Member
            • Apr 2008
            • 47

            #6
            Also what type of files are they?

            Comment

            • wolfenstein
              New Member
              • Mar 2008
              • 25

              #7
              These files are .Vox (Audio files) and the copy is been made in the .Net file systems object. I don't know the mechanism behind this copy.

              Comment

              Working...