⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 multithreadtest.cs

📁 DataMatrix二维条码识别算法,基于Windows
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using IEC16022Sharp;
using System.Drawing;


namespace TestApp
{
    internal class MultiThreadTest
    {

        public static void Exec()
        {
            Console.WriteLine("\n***MultiThreadTest***");
            int paralleThread = 5;
            Thread[] t = new Thread[paralleThread];

            for (int i = 0; i < paralleThread; i++)
            {
                t[i] = new Thread(new ThreadStart(Test4_ThreadRun));
                t[i].Name = "Thrd_" + i.ToString("000");
                t[i].IsBackground = true;
                t[i].Start();
            }

            for (int i = 0; i < paralleThread; i++)
                t[i].Join();

        }


        private static void Test4_ThreadRun()
        {
            Console.WriteLine(Thread.CurrentThread.Name + " started");
            for (int i = 0; i < 1000; i++)
            {
                DataMatrix dm1 = new DataMatrix(
                    "Lorem ipsum dolor sit amet, consectetur adipisicing elit, " +
                    "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua");
                Bitmap bmp = dm1.Image;
            }
            Console.WriteLine(Thread.CurrentThread.Name + " end");
        }


    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -