I have a a thread I am trying to stop in the OnStop method, could someone demonstrate how you could terminate / stop a thread with it:
/// <summary>
/// OnStop: Put your stop code here
/// - Stop threads, set final data, etc.
/// </summary>
protected override void OnStop()
{
base.OnStop();
}
Taking into account, that is start like follows:
/// <summary>
/// OnStart: Put startup code here
/// - Start threads, get inital data, etc.
/// </summary>
/// <param name="args"></param>
protected override void OnStart(string[] args)
{
Thread MyThread = new Thread(new ThreadStart(MyThreadStarter));
MyThread.Start();
base.OnStart(args);
}
private void MyThreadStarter()
{
realtime obj = new realtime();
obj.Starter();
}