473,387 Members | 1,512 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,387 software developers and data experts.

Threading shutdown question

I have a windows service that starts up about 6 class modules, that each
start a worker thread. When I stop my windows service, will these classes
and threads go away? Or do I need to explicitly stop each of them?
Nov 23 '05 #1
2 952
it is recommended to stop each of them (structure wise). Additionnally, it
would be good not to make your threads sleep for too long, because they will
not exit before the sleep method is done, so if you make the thread sleep
for 60,000ms, then the thread will not exit until the minute of sleep is
done. So it can slowdown the closing of your service by quite a lot.

I hope it helps

ThunderMusic

"Terry Olsen" <to******@hotmail.com> a écrit dans le message de news:
eV**************@TK2MSFTNGP15.phx.gbl...
I have a windows service that starts up about 6 class modules, that each
start a worker thread. When I stop my windows service, will these classes
and threads go away? Or do I need to explicitly stop each of them?

Nov 23 '05 #2
Hi,

The threads should exit gracefully if:

Thread.IsBackground = True

Dick
--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.
Nov 23 '05 #3

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

Similar topics

0
by: David | last post by:
I've written a small windows service, and I'm having a problem that I'm spending a lot more time on than I'd like. If anyone has experienced this problem and has any hints or solutions; they would...
0
by: Darren Thomas | last post by:
Dear all, I have written a TCP server as a windows service that accepts connections using the System.Net.Sockets.Socket class. I use the various asynchronous methods in the socket class. I'm...
77
by: Jon Skeet [C# MVP] | last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the article on all the groups this is posted to. I've finally managed to finish my article on multi-threading - at least for...
4
by: Tuvas | last post by:
I am trying to write a thread that will execute a function every 2 seconds until the program is close, in which case it will stop. I can write the program easy enough to execute the command every 2...
3
by: Jon Pope | last post by:
I've got a basic question about threading which I'm hoping someone here will be able to answer: Let's say my calling CallingClass has instantiated and started a worker thread. When my worker...
4
by: Jerry Camel | last post by:
Any insight here is greatly appreciated... (Eveything is in VB .NET) Here's the baisc app flow: ------------------------------------- Launch wrapper.exe: wrapper.exe registers for the...
3
by: Keith Mills | last post by:
Hello, please find attached a basic outline of what I am attempting to accomplish... basically I want to create a number of THREADS (which I can do fine), but I then need a method for them to be...
2
by: Sin Jeong-hun | last post by:
I created a windows form application. It has a Threading.Timer and when the timer ticks it does some work and show a popup window. The problem is that while this program is running if the user...
1
by: Nico Blodow | last post by:
Hi all, I hope this hasn't been brought up before, but if it did i missed it, so bear with me please :) anyway, i'm trying to embed Python into a C program. A sample python syript i want to run...
1
by: ~levon | last post by:
Hello group, in following example, a signal handler is registered and a thread started. if I call self.doSomethin() directly the code works as I would expect. as i send a SIGINT shutdown is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.