多核编程与并行计算
、实验九:
using System;
using System.Threading;
class Test
{
}
class Work
{
public static void DoWork() { } public int Data; public void DoMoreWork() { Console.WriteLine("Instance thread procedure. Data={0}", Data); Console.WriteLine("Static thread procedure."); static void Main() { } ThreadStart threadDelegate = new ThreadStart(Work.DoWork); Thread newThread = new Thread(threadDelegate); newThread.Start(); Work w = new Work(); w.Data = 42; threadDelegate = new ThreadStart(w.DoMoreWork); newThread = new Thread(threadDelegate); newThread.Start();