标题:过于一个线程的问题,请教一下,谢谢
取消只看楼主
jhtchina
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2004-11-4
 问题点数:0 回复次数:1 
过于一个线程的问题,请教一下,谢谢
using System;
using System.Threading;
namespace Temp2
{
    class Class1
    {
        static void Founction1()
        {
            for (int i=0;i<10;i++)
                Console.WriteLine("Work in Founction1.");
        }
        static void Founction2()
        {
            for (int i=0;i<10;i++)
                             Console.WriteLine("Work in Founction2.");
        }
        [STAThread]
        static void Main(string[] args)
        {            
                            ThreadStart ts1=new ThreadStart(Founction1);
            ThreadStart ts2=new ThreadStart(Founction2);
                            Thread t1=new Thread(ts1);
            Thread t2=new Thread(ts2);     t1.Priority=System.Threading.ThreadPriority.AboveNormal;
            t1.Priority=System.Threading.ThreadPriority.Lowest;            t1.Start();
            t2.Start();            
        }
    }
}
这个程序运行没有问题,但是如果函数:
static void Founction1(int n1);
static void Founction2(int n2);
执行线程如何把参数传递到函数里面?需要用委托,但是我不会用,怎么作?帮助一下,谢谢。
搜索更多相关主题的帖子: 线程 void static using 
2004-11-05 09:50
jhtchina
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2004-11-4
得分:0 
就是说在执行线程时,吧参数传递到函数里面,上面的线程是无参函数,如果是有参函数怎么办?
2004-11-05 18:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-7128-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018158 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved