Thread 사용법
public static void Main(string[] args)
{
// Thread 에 객체 생성
Thread MyThread = new Thread(new ThreadStart(MyCallbackFunction));
MyThread.Start();
}
public static void MyCallbackFunction()
{
while(true)
{
System.Console.WriteLine("Thread Test");
}
}
NotSupportedException 에러가 나타난다면
public static void Main(string[] args)
{
// Thread 에 객체 생성
Thread MyThread = new Thread(new ThreadStart(MyCallbackFunction));
MyThread.Start();
}
public static void MyCallbackFunction()
{
if(InvokeRequired)
{
Invoke(new MathodInvoker(CloseThreading));
return;
}
System.Console.WriteLine("Thread Test");
}
private void ThreadMethod()
{
Invoke(new MathodInvoker(CloseThreading));
}
delegate void MathodInvoker();