private void StopUnion() { Console.WriteLine("Interrupting Union Thread"); Uth.Interrupt(); Console.WriteLine("Waiting until Union thread stops"); Uth.Join(); this.BackColor = defaultColor; stopUnionButton.Enabled = false; executeUnionButton.Enabled = true; }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (Uth.IsAlive) { Console.WriteLine("Interrupt for Form Close"); Uth.Interrupt(); Console.WriteLine("Waiting until thread stops for Form Close"); Uth.Join(); } if (Mth.IsAlive) { Console.WriteLine("Interrupt for Form Close"); Mth.Interrupt(); Console.WriteLine("Waiting until thread stops for Form Close"); Mth.Join(); } }