473,396 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Killing Threads

I have a service that executes a method in a dll. This method spawns
several threads.

When I stop the service I notice the process doesn't stop right away. I
assume the threads that some time to finish. What can I don the the
OnStop method to insure all threads are completed before stopping the
service?

Thanks for any help.

Nov 23 '05 #1
2 1305
Hello Mitchell

The framework makes a distinction between threads that run in the
foreground and those in the background.
If a thread is marked as a background thread, the framework does not wait
for it to finish in the event that the AppDomain is shut down

so if your threads are foreground threads the AppDomain is shut down aftere
there completion

regards

Michel Posseth [MCP]
<mm*******@capstonetechnology.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I have a service that executes a method in a dll. This method spawns
several threads.

When I stop the service I notice the process doesn't stop right away. I
assume the threads that some time to finish. What can I don the the
OnStop method to insure all threads are completed before stopping the
service?

Thanks for any help.

Nov 23 '05 #2
I think you cannot do that.
On shutdown, Windows only wait 2 secs to kill each serice.

<mm*******@capstonetechnology.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I have a service that executes a method in a dll. This method spawns
several threads.

When I stop the service I notice the process doesn't stop right away. I
assume the threads that some time to finish. What can I don the the
OnStop method to insure all threads are completed before stopping the
service?

Thanks for any help.

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Don Garrett | last post by:
I've been developing with external multi-threaded libraries recently. I find it difficult to use the Python prompt to experiment with these libraries because there isn't any way to just shutdown...
6
by: Colin Steadman | last post by:
I have created a function to kill all session variables that aren't in a safe list. This is the function - Sub PurgeSessionVariables For Each Item In Session.Contents Select Case Trim(Item)...
10
by: Jacek Popławski | last post by:
Hello. I am going to write python script which will read python command from socket, run it and return some values back to socket. My problem is, that I need some timeout. I need to say for...
4
by: muscha | last post by:
Hi, I spawns a number of background threads while creating a windows forms application. I noticed that when I quit the application or calling Application.Exit, it hasn't really stop. Is there a...
6
by: Bob Day | last post by:
VS 2003, vb.net ... Is there an easy way to kill from the main form all threads running ? Is there a thread collection to iterate through to kill each one? I know each thread's name, so could...
10
by: Michael | last post by:
How do I kill the thread of one button with the clicking of another button? ie Private Sub btnEnglish_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnglish.Click ...
8
by: Rob | last post by:
Hello, I've got an issue where a process in a third party application has a dll which while exiting sort of freezes and runs away with processor cycles. i've written a block of code so that I...
18
by: J.K. Baltzersen | last post by:
To whomever it may concern: I am using MS Visual C++ 6.0. I have a process A which instantiates an object C. At a later point the process A creates the thread B. The thread B has access...
6
by: Roger Heathcote | last post by:
sjdevnull@yahoo.com wrote: <snip> Fair point, but for sub processes that need to be in close contact with the original app, or very small functions that you'd like 100s or 1000s of it seems...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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...

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.