ConcurrentExclusiveSchedulerPair 생성자

정의

ConcurrentExclusiveSchedulerPair 클래스의 새 인스턴스를 초기화합니다.

오버로드

ConcurrentExclusiveSchedulerPair()

ConcurrentExclusiveSchedulerPair 클래스의 새 인스턴스를 초기화합니다.

ConcurrentExclusiveSchedulerPair(TaskScheduler)

지정된 스케줄러를 대상으로 하는 ConcurrentExclusiveSchedulerPair 클래스의 새 인스턴스를 초기화합니다.

ConcurrentExclusiveSchedulerPair(TaskScheduler, Int32)

최대 동시성 수준을 사용하여 지정된 스케줄러를 대상으로 하는 ConcurrentExclusiveSchedulerPair 클래스의 새 인스턴스를 초기화합니다.

ConcurrentExclusiveSchedulerPair(TaskScheduler, Int32, Int32)

최대 동시성 수준과 예약된 최대 작업 수(단위로 처리될 수도 있음)와 함께 지정한 스케줄러를 대상으로 하는 ConcurrentExclusiveSchedulerPair 클래스의 새 인스턴스를 초기화하고 보호 수준에 서명합니다.

ConcurrentExclusiveSchedulerPair()

ConcurrentExclusiveSchedulerPair 클래스의 새 인스턴스를 초기화합니다.

public:
 ConcurrentExclusiveSchedulerPair();
public ConcurrentExclusiveSchedulerPair ();
Public Sub New ()

예제

다음 예제에서는 사용 된 ConcurrentExclusiveSchedulerPair 새 생성자 ConcurrentExclusiveSchedulerPair 개체입니다. 이 코드 예제는 방법: 데이터 흐름 블록 아티클에서 작업 스케줄러 지정에 제공된 더 큰 예제의 일부입니다.

// Create a ConcurrentExclusiveSchedulerPair object.
// Readers will run on the concurrent part of the scheduler pair.
// The writer will run on the exclusive part of the scheduler pair.
var taskSchedulerPair = new ConcurrentExclusiveSchedulerPair();

// Create an ActionBlock<int> object for each reader CheckBox object.
// Each ActionBlock<int> object represents an action that can read 
// from a resource in parallel to other readers.
// Specifying the concurrent part of the scheduler pair enables the 
// reader to run in parallel to other actions that are managed by 
// that scheduler.
var readerActions =
   from checkBox in new CheckBox[] { checkBox1, checkBox2, checkBox3 }
   select new ActionBlock<int>(milliseconds =>
   {
       // Toggle the check box to the checked state.
       toggleCheckBox.Post(checkBox);

       // Perform the read action. For demonstration, suspend the current
       // thread to simulate a lengthy read operation.
       Thread.Sleep(milliseconds);

       // Toggle the check box to the unchecked state.
       toggleCheckBox.Post(checkBox);
   },
   new ExecutionDataflowBlockOptions
   {
       TaskScheduler = taskSchedulerPair.ConcurrentScheduler
   });

// Create an ActionBlock<int> object for the writer CheckBox object.
// This ActionBlock<int> object represents an action that writes to 
// a resource, but cannot run in parallel to readers.
// Specifying the exclusive part of the scheduler pair enables the 
// writer to run in exclusively with respect to other actions that are 
// managed by the scheduler pair.
var writerAction = new ActionBlock<int>(milliseconds =>
{
    // Toggle the check box to the checked state.
    toggleCheckBox.Post(checkBox4);

    // Perform the write action. For demonstration, suspend the current
    // thread to simulate a lengthy write operation.
    Thread.Sleep(milliseconds);

    // Toggle the check box to the unchecked state.
    toggleCheckBox.Post(checkBox4);
},
new ExecutionDataflowBlockOptions
{
    TaskScheduler = taskSchedulerPair.ExclusiveScheduler
});

// Link the broadcaster to each reader and writer block.
// The BroadcastBlock<T> class propagates values that it 
// receives to all connected targets.
foreach (var readerAction in readerActions)
{
    broadcaster.LinkTo(readerAction);
}
broadcaster.LinkTo(writerAction);
' Create a ConcurrentExclusiveSchedulerPair object.
' Readers will run on the concurrent part of the scheduler pair.
' The writer will run on the exclusive part of the scheduler pair.
Dim taskSchedulerPair = New ConcurrentExclusiveSchedulerPair()

' Create an ActionBlock<int> object for each reader CheckBox object.
' Each ActionBlock<int> object represents an action that can read 
' from a resource in parallel to other readers.
' Specifying the concurrent part of the scheduler pair enables the 
' reader to run in parallel to other actions that are managed by 
' that scheduler.
Dim readerActions = From checkBox In New CheckBox() {checkBox1, checkBox2, checkBox3}
                    Select New ActionBlock(Of Integer)(Sub(milliseconds)
                                                           ' Toggle the check box to the checked state.
                                                           ' Perform the read action. For demonstration, suspend the current
                                                           ' thread to simulate a lengthy read operation.
                                                           ' Toggle the check box to the unchecked state.
                                                           toggleCheckBox.Post(checkBox)
                                                           Thread.Sleep(milliseconds)
                                                           toggleCheckBox.Post(checkBox)
                                                       End Sub, New ExecutionDataflowBlockOptions With {.TaskScheduler = taskSchedulerPair.ConcurrentScheduler})

' Create an ActionBlock<int> object for the writer CheckBox object.
' This ActionBlock<int> object represents an action that writes to 
' a resource, but cannot run in parallel to readers.
' Specifying the exclusive part of the scheduler pair enables the 
' writer to run in exclusively with respect to other actions that are 
' managed by the scheduler pair.
Dim writerAction = New ActionBlock(Of Integer)(Sub(milliseconds)
                                                   ' Toggle the check box to the checked state.
                                                   ' Perform the write action. For demonstration, suspend the current
                                                   ' thread to simulate a lengthy write operation.
                                                   ' Toggle the check box to the unchecked state.
                                                   toggleCheckBox.Post(checkBox4)
                                                   Thread.Sleep(milliseconds)
                                                   toggleCheckBox.Post(checkBox4)
                                               End Sub, New ExecutionDataflowBlockOptions With {.TaskScheduler = taskSchedulerPair.ExclusiveScheduler})

' Link the broadcaster to each reader and writer block.
' The BroadcastBlock<T> class propagates values that it 
' receives to all connected targets.
For Each readerAction In readerActions
    broadcaster.LinkTo(readerAction)
Next readerAction
broadcaster.LinkTo(writerAction)

적용 대상

ConcurrentExclusiveSchedulerPair(TaskScheduler)

지정된 스케줄러를 대상으로 하는 ConcurrentExclusiveSchedulerPair 클래스의 새 인스턴스를 초기화합니다.

public:
 ConcurrentExclusiveSchedulerPair(System::Threading::Tasks::TaskScheduler ^ taskScheduler);
public ConcurrentExclusiveSchedulerPair (System.Threading.Tasks.TaskScheduler taskScheduler);
new System.Threading.Tasks.ConcurrentExclusiveSchedulerPair : System.Threading.Tasks.TaskScheduler -> System.Threading.Tasks.ConcurrentExclusiveSchedulerPair
Public Sub New (taskScheduler As TaskScheduler)

매개 변수

taskScheduler
TaskScheduler

이 쌍을 실행해야 하는 대상 스케줄러입니다.

적용 대상

ConcurrentExclusiveSchedulerPair(TaskScheduler, Int32)

최대 동시성 수준을 사용하여 지정된 스케줄러를 대상으로 하는 ConcurrentExclusiveSchedulerPair 클래스의 새 인스턴스를 초기화합니다.

public:
 ConcurrentExclusiveSchedulerPair(System::Threading::Tasks::TaskScheduler ^ taskScheduler, int maxConcurrencyLevel);
public ConcurrentExclusiveSchedulerPair (System.Threading.Tasks.TaskScheduler taskScheduler, int maxConcurrencyLevel);
new System.Threading.Tasks.ConcurrentExclusiveSchedulerPair : System.Threading.Tasks.TaskScheduler * int -> System.Threading.Tasks.ConcurrentExclusiveSchedulerPair
Public Sub New (taskScheduler As TaskScheduler, maxConcurrencyLevel As Integer)

매개 변수

taskScheduler
TaskScheduler

이 쌍을 실행해야 하는 대상 스케줄러입니다.

maxConcurrencyLevel
Int32

동시에 실행할 최대 작업 수입니다.

적용 대상

ConcurrentExclusiveSchedulerPair(TaskScheduler, Int32, Int32)

최대 동시성 수준과 예약된 최대 작업 수(단위로 처리될 수도 있음)와 함께 지정한 스케줄러를 대상으로 하는 ConcurrentExclusiveSchedulerPair 클래스의 새 인스턴스를 초기화하고 보호 수준에 서명합니다.

public:
 ConcurrentExclusiveSchedulerPair(System::Threading::Tasks::TaskScheduler ^ taskScheduler, int maxConcurrencyLevel, int maxItemsPerTask);
public ConcurrentExclusiveSchedulerPair (System.Threading.Tasks.TaskScheduler taskScheduler, int maxConcurrencyLevel, int maxItemsPerTask);
new System.Threading.Tasks.ConcurrentExclusiveSchedulerPair : System.Threading.Tasks.TaskScheduler * int * int -> System.Threading.Tasks.ConcurrentExclusiveSchedulerPair
Public Sub New (taskScheduler As TaskScheduler, maxConcurrencyLevel As Integer, maxItemsPerTask As Integer)

매개 변수

taskScheduler
TaskScheduler

이 쌍을 실행해야 하는 대상 스케줄러입니다.

maxConcurrencyLevel
Int32

동시에 실행할 최대 작업 수입니다.

maxItemsPerTask
Int32

쌍으로 사용되는 예약된 각 내부 작업을 처리하는 최대 작업 수입니다.

적용 대상