Skip to content

Instantly share code, notes, and snippets.

@tpdns90321
Last active April 12, 2016 06:43
Show Gist options
  • Save tpdns90321/62602e211d7ee29fdca0c92b0bef7b7a to your computer and use it in GitHub Desktop.
Save tpdns90321/62602e211d7ee29fdca0c92b0bef7b7a to your computer and use it in GitHub Desktop.
C# Thread Example
using System;
using System.Threading;
namespace FuncAStop{
class Program{
static Thread A;
static Thread B;
static void FuncA(){
for (int i = 0; i < 100; i++){
Console.WriteLine("A : " + i);
}
}
static void FuncB(){
for (int i = 0; i < 100; i++){
if (i == 15){
A.Abort();
}
Console.WriteLine("B : " + i);
}
}
static void Main(string[] args){
A = new Thread(FuncA);
B = new Thread(FuncB);
A.Start();
B.Start();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment