R
Randy Geyer
I have an NT/W2K service that spawns 3 worker threads that each do different
things. For example, one monitors an email mailbox for incoming items and
puts them in a queue for processing by a 2nd thread. The 3rd thread polls a
database for updates and performs different processing. The actual
implementation is more complicated than this, but that's the basic
architecture.
My question is this: How do I gracefully shut down the service if one of
the worker threads encounters a fatal error? Example: if the mailbox is not
available, the service should gracefully stop (all threads) and log an
error. My current implementation will shutdown only the affected thread but
the others keep on going fat, dumb, and happy. This is not the desired
system behavior, but I'm not sure how to notify the main service thread of a
fatal error so it can shutdown the other threads and then gracefully stop
the service.
Is it as simple as calling the SCM and stopping the service from the failing
thread?
Any assistance is greatly appreciated! If this is not the proper group,
please redirect me.
things. For example, one monitors an email mailbox for incoming items and
puts them in a queue for processing by a 2nd thread. The 3rd thread polls a
database for updates and performs different processing. The actual
implementation is more complicated than this, but that's the basic
architecture.
My question is this: How do I gracefully shut down the service if one of
the worker threads encounters a fatal error? Example: if the mailbox is not
available, the service should gracefully stop (all threads) and log an
error. My current implementation will shutdown only the affected thread but
the others keep on going fat, dumb, and happy. This is not the desired
system behavior, but I'm not sure how to notify the main service thread of a
fatal error so it can shutdown the other threads and then gracefully stop
the service.
Is it as simple as calling the SCM and stopping the service from the failing
thread?
Any assistance is greatly appreciated! If this is not the proper group,
please redirect me.