473,513 Members | 10,313 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Stop a Running Thread

25 New Member
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!
Apr 18 '08 #1
6 1307
wolfenstein
25 New Member
No suggestion, NO reply at all :(
Apr 21 '08 #2
Mr Gray
47 New Member
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.
Apr 21 '08 #3
wolfenstein
25 New Member
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.
Apr 21 '08 #4
Mr Gray
47 New Member
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.
Apr 21 '08 #5
Mr Gray
47 New Member
Also what type of files are they?
Apr 21 '08 #6
wolfenstein
25 New Member
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.
Apr 21 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

9
2394
by: Harald Armin Massa | last post by:
I need to do some synchronisations like in a cron.job import time from threading import Thread class updater(Thread): def run(self): while True: do_updates() time.sleep(600)
1
363
by: Peter Steele | last post by:
Okay, I assume I'm missing something obvious here. I have created a simple service in C# that on starting spawns a thread to do some processing. The service can be stopped with a "net stop" command...
2
2829
by: Prasad | last post by:
Hi, I am writing a service which takes a long time to stop after the OnStop call is given by the Services Snap-in. The problem is I cannot cut down on the time that it takes to Stop. The Service...
26
4664
by: Ricardo | last post by:
I made a program that generate random numbers and put it in a listbox when the user click go. The problem is: how can i made a button stop, to stop the method that is running??? s...
1
2234
by: magic man via .NET 247 | last post by:
hi everyone i have a c# application that uses multithreading toconnect to sql server and execute a stored procedure on theserver. i am using a dataset,sqlcommand,dataadapter and adatagrid to carry...
2
3742
by: trint | last post by:
Ok, I click on 'exit' and have it calling (function is started in new thread): this.m_notifyicon.Dispose(); Application.Exit(); or this.Close(); And TaskManager shows it still running!
5
8974
by: Torben Laursen | last post by:
Hi My interface calls a C++ dll that runs a slow calculations. So I call the dll inside a BackgroundWorker thread, and that all works fine. But how can I stop the thread if the user wants to?...
0
1755
by: Dirk Runge | last post by:
Hi! I have embedded Python in an C++ App. The Python-Interpreter is running in its own Thread (I'm using PThreads). I use PyRun_SimpleString to run Python-Code that the user entered in an...
0
2173
by: mattcfisher | last post by:
Hi, I have two windows services running together. One is the main program, and one is an "updater" wrapper for the main. The updater service starts and stops the main one (as in you should never...
0
1303
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I have a windows application that does not stop running whenever the application exits. Could someone fill me in on what I am doing wrong? Here is the relevant code:...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7373
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7094
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7519
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.