示例#1
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (SumThread != null)
     {
         SumThread.Abort();
     }
 }
示例#2
0
        static void Main(string[] args)
        {
            int[]     a   = { 1, 2, 3, 4, 5 };
            SumThread st1 = new SumThread("Stream 1", a);
            SumThread st2 = new SumThread("Stream 2", a);

            st1.Thrd.Join();
            st2.Thrd.Join();
            SumThread st3 = new SumThread("StreamNL 1", a, false);
            SumThread st4 = new SumThread("StreamNL 2", a, false);
        }
示例#3
0
        private void NumSum(object n)
        {
            long sum = 0;
            long k   = Convert.ToInt64(n);

            for (int i = 0; i <= k; i++)
            {
                Thread.Sleep(1);
                sum += i;
                Invoke(ResultView, "계산중 : " + sum.ToString());
            }

            Invoke(ResultView, "완료 결과 : " + sum.ToString());
            SumThread.Abort();
        }