zoukankan      html  css  js  c++  java
  • 多线程

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Threading;

    namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }

            public delegate void game(string name);
            private void Form1_Load(object sender, EventArgs e)
            {
                game g = new game(test);
                this.Invoke(g, new object[] { "long" });
                gobanghadler += new gobang(Form1_gobanghadler);

                Thread[] ths = new Thread[3];
                for (int i = 0; i < 3; i++)
                {
                  
                    ths[i] = new Thread(new ThreadStart(delegate { MessageBox.Show(i.ToString()); }));
                    ths[i].Name = i.ToString();
                    ths[i].Start();
                }
            }
            public void test(string name)
            {
                MessageBox.Show(name);
            }
            void Form1_gobanghadler(string name)
            {
                throw new NotImplementedException();
            }
            public delegate void gobang(string name);
            public event gobang gobanghadler;

        }
    }

  • 相关阅读:
    Linux系统安全及应用
    Linux 10 进程和计划的管理任务
    Centos netdata 的安装及配置
    Centos nmon安装及使用
    Python 各种数据类型的了解(上)
    神奇的循环知识
    Pathon的基础知识
    初次遇见Python
    操作系统与编程语言的简介
    计算机硬件基础
  • 原文地址:https://www.cnblogs.com/lifeOfIT/p/2802030.html
Copyright © 2011-2022 走看看