|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Thread management in a Windows serviceI have a service written in VB.Net 2.0 that watches a folder for text
files and, when a text file is placed in the folder, moves it elsewhere and processes it. I would like to optimize the service by putting each document on its own worker thread. My main question is: what would happen if a service shut-down command is issued and there are pending threads? I am hoping that the service will wait until all of the worker threads have terminated before shutting down, but I fear it won't be that easy. Any suggestions -- or better, code examples available on the web -- would be much appreciated. -- Gregory Gadow I don't have a code example handy, but probably the easiest way to do work in
the background is using the new BackgroundWorker component. I believe that when a service gets a shutdown notification, it will end up calling your service code to do the shutdown. In here, you could either wait for the background workers to complete, or send a cancel to them to make them terminate. Show quoteHide quote "Gregory Gadow" wrote: > I have a service written in VB.Net 2.0 that watches a folder for text > files and, when a text file is placed in the folder, moves it elsewhere > and processes it. I would like to optimize the service by putting each > document on its own worker thread. > > My main question is: what would happen if a service shut-down command is > issued and there are pending threads? I am hoping that the service will > wait until all of the worker threads have terminated before shutting > down, but I fear it won't be that easy. Any suggestions -- or better, > code examples available on the web -- would be much appreciated. > -- > Gregory Gadow > > >
Inheritance
Clean up issues What happened to the Class view in VS2005? Two Relatively Simple Questions Hide Window form (top most) VB 2005 - How to hook into Windows to intercept all mouse events? Novice Question About Webclient A place to discuss future vb featuresause? Menu is disapearing in 2005 uint32 conversion on win32_pingstatus |
|||||||||||||||||||||||