Hi,
While the OnStart method is running, the service is in "starting" state.
You definitively have to return from it, as the service manager will
kill your process if it doesn't manage to return from OnStart in 90
seconds or so.
As for the Thread.Abort(), maybe a better idea would be to implement the
shutdown mechanism using a volatile bool flag. See
http://www.interact-sw.co.uk/iangblog/2004/11/12/cancellation
for why using Thread.Abort() might not be the best solution.
HTH,
Stefan
> Something I can't quite get out of the docs, is what the 'normal' way is to
> implement a service's main body.
[quoted text clipped - 16 lines]
> The service runs until the thread is stopped, but I was wondering if I
> might be creating a thread I don't need.
Lucvdv - 14 Jun 2005 16:50 GMT
> Hi,
>
> While the OnStart method is running, the service is in "starting" state.
> You definitively have to return from it, as the service manager will
> kill your process if it doesn't manage to return from OnStart in 90
> seconds or so.
Thanks. That's exactly what I needed/wanted to hear.
> As for the Thread.Abort(), maybe a better idea would be to implement the
> shutdown mechanism using a volatile bool flag. See
Not much of an issue in this case, but thanks for the warning.