c# 线程锁实现多线程售票代码

代码语言:c#

所属分类:通讯

代码描述:c# 线程锁实现多线程售票代码

代码标签: 实现 多线程 售票

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

using System;
using System.Threading;
namespace HelloWorldApplication
{
    class HelloWorld
    {
        static void Main(string[] args) {
            Ticket t = new Ticket();
            Ticket.obj.i = 10;
            Thread th1 = new Thread(new ThreadStart(t.sale));
            th1.Name = "th1";
            th1.Start();

            Thread th2 = new Thread(new ThreadStart(t.sale));
            th2.Name = "th2";
            th2.Start();
      .........完整代码请登录后点击上方下载按钮下载查看

网友评论0