zoukankan      html  css  js  c++  java
  • c#线程问题(3)

    //执行回调函数


    static
    void Main(string[] args) { UPPER = 1000; Thread thread1=new Thread(sops); thread1.Name = "thread1"; thread1.Start(); Thread thread2=new Thread(sops); thread2.Name = "thread2"; thread2.Start(); Console.ReadLine(); } static void Callback(object o) { for (int i = 0; i < UPPER; i++) { Console.WriteLine(o); } } static void sops() { for (int i = 0; i < UPPER; i++) { Console.WriteLine("hello this data is {0}++++++++++++++++{1}", Thread.CurrentThread.Name, i); }  Console.WriteLine( Thread.CurrentThread.Name+"over"); ExecutionContext.Run(ExecutionContext.Capture(), new ContextCallback(Callback), Thread.CurrentThread.Name); } public static int UPPER { get; set; }
  • 相关阅读:
    11.26
    数组
    JavaScript
    2018.11.26
    input标签
    HPH 函数
    jQuery
    19/1/3数组
    2018/12/26//循环体
    12/25
  • 原文地址:https://www.cnblogs.com/anbylau2130/p/3183510.html
Copyright © 2011-2022 走看看