Simple question me thinks...
When OnStop() is called from the service manager how do I tell the thread that was created in OnStart() that it needs stop doing what it is doing?
Another question is, if for some reason I cannot stop the thread yet, is there a safe way to let the service mangager know this and I will shutdown the thread when I can?
I have the following basic service class:Code:public class Replication : System.ServiceProcess.ServiceBase { static ReplicationMain replicationService = new ReplicationMain(); protected override void OnStart(string[] args) { Thread workerThread = new Thread(new ThreadStart(replicationService.Start)); workerThread.Start(); this.isStopped = true; } protected override void OnStop() { // How to tell replicationService we are shutting down } }So once I am in the ReplicationMain class I was not sure how I can get a message from the Replication class. I hope that made sense.Code:public class ReplicationMain { public void Start() { } }
Steve




Reply With Quote