최대 평행 나사산 설정
using IronBarCode;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

List<string> imagePaths = new List<string>() { "sample_a.png", "sample_b.png" };

// Barcode reading options
BarcodeReaderOptions options = new BarcodeReaderOptions()
{
    // Set Max threads to 4
    Multithreaded = true,
    MaxParallelThreads = 4,
};

// Read barcode with multithreaded enabled
BarcodeResults results = BarcodeReader.Read(imagePaths, options);

NuGet Download
PM > Install-Package BarCode
최대 평행 나사산 설정

최대 평행 나사산 설정

문서나 이미지를 순차적으로 대량 처리하는 것은 시간이 많이 걸리며 대량 응용 프로그램에서 병목 현상을 일으킬 수 있습니다. 병렬 스레드를 사용하면 응용 프로그램이 여러 이미지를 동시에 처리할 수 있어 전체 실행 시간을 크게 단축할 수 있습니다. 이 코드 예제에서는 IronBarcode를 설정하여 더 빠른 배치 바코드 읽기를 위해 멀티스레딩을 사용하는 방법을 보여줄 것입니다.

바코드를 읽기 위한 병렬 스레드 사용을 위한 5단계 가이드

  • using IronBarCode;
  • using System.Threading.Tasks;
  • List<string> imagePaths = new List<string>() { "sample_a.png", "sample_b.png" };
  • BarcodeReaderOptions options = new BarcodeReaderOptions(){ Multithreaded = true, MaxParallelThreads = 4 };
  • BarcodeResults results = BarcodeReader.Read(imagePaths, options);

코드 설명

먼저, IronBarcode 라이브러리와 스레드 네임스페이스가 가져오고 처리할 이미지의 파일 경로를 포함한 List<string>를 정의합니다. 위 예제에서는 "sample_a.png"와 "sample_b.png"가 스캔 준비되었습니다.

다음으로, 스캐닝 동작을 설정하기 위해 BarcodeReaderOptions 객체가 인스턴스화됩니다. 또한, 병렬 처리를 활성화하기 위해 ParallelProcessing 속성을 true로 설정합니다. Multithreaded MaxDegreeOfParallelism 속성 역시 4로 설정되어, 성능과 시스템 자원 사용의 균형을 유지하며 최대 4개의 동시 스레드를 사용하도록 리더에게 지시합니다. Multithreaded MaxParallelThreads MaxParallelThreads Read BarcodeReader.Read

마지막으로, 이미지 경로 목록과 구성된 옵션을 전달하여 BarcodeResults을(를) 검색하기 위해 ReadBarcodes가 호출됩니다.

IronBarcode로 최대 병렬 스레드를 설정하는 방법 배우기

시작할 준비 되셨나요?

Nuget Downloads 2,540,041버전:2026.11방금 출시