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;

        }
    }

  • 相关阅读:
    Play 中如何使用 Ajax
    Play!中使用HTTP异步编程
    Asynchronous Jobs
    Play libs
    JPA persistence
    maven 打包和构建的Linux命令(mvn)
    Istio的流量管理入门-charlieroro编写
    Linux和Docker的Capabilities介绍及Setcap命令
    2020超实用提升英文阅读能力和必备3000单词表
    Cookie什么?Cookie和Session防御怎么做?
  • 原文地址:https://www.cnblogs.com/lifeOfIT/p/2802030.html
Copyright © 2011-2022 走看看