title: How do I abort multiple threads?
body: <p>In this code, when <code>button1</code> is clicked twice, it creates 2 separate threads. On one click, it creates a new thread on the heap and field <code>t1</code> points to the new thread on the heap. When I click <code>button2</code>, it aborts the last thread (which <code>t1</code> refers to).  </p>
  
  <p>How do I abort the <em>other</em> thread?  </p>
  
  <pre><code>Thread t1;
  ThreadStart ts1;
  
  private void button1_Click(object sender, EventArgs e)
  {
      ts1 = new ThreadStart(myfunc);
      t1 = new Thread(ts1);
      t1.Start();
  }
  
  private void button2_Click(object sender, EventArgs e)
  {
      t1.Abort();
  }
  </code></pre>