Window Service and Threads

  • Thread starter Thread starter JJ
  • Start date Start date
J

JJ

I have a window service that spawned a separate thread. Now I would
make sure to process some work and then close the thread. After I
closed this thread I wanted to shut down the service but would never
be able to stop service even though I would call OnStop() on the
service. Now I went another way with the solution and had a timer in
the service kick off and do some work. With this sol. I was able to
close down the service without any problems. My question is why did
this work compared to creating my own thread? What is different with a
timer thread and using System.Threading?

JJ
 
JJ,

If you are going to shut yourself down, why have a service in the first
place? Services that shut themselves down should not be modeled as
services, but as applications.
 
Back
Top