Table of Contents

Class WorkersTaskScheduler

Namespace
Inetlab.SMPP.Common
Assembly
Inetlab.SMPP.dll

Created workers threads to handle queued tasks.

public sealed class WorkersTaskScheduler : TaskScheduler, IDisposable
Inheritance
WorkersTaskScheduler
Implements
Inherited Members

Constructors

WorkersTaskScheduler(int, string, CancellationToken)

public WorkersTaskScheduler(int workersCount, string threadName = null, CancellationToken token = default)

Parameters

workersCount int
threadName string
token CancellationToken

Properties

Count

The number of queued tasks.

public int Count { get; }

Property Value

int

MaximumConcurrencyLevel

Indicates the maximum concurrency level this TaskScheduler is able to support.

public override int MaximumConcurrencyLevel { get; }

Property Value

int

Returns an integer that represents the maximum concurrency level. The default scheduler returns MaxValue.

WorkerCount

Specifies a number of worker threads that process received messages.

public int WorkerCount { get; set; }

Property Value

int

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

GetScheduledTasks()

For debugger support only, generates an enumerable of Task instances currently queued to the scheduler waiting to be executed.

protected override IEnumerable<Task> GetScheduledTasks()

Returns

IEnumerable<Task>

An enumerable that allows a debugger to traverse the tasks currently queued to this scheduler.

Exceptions

NotSupportedException

This scheduler is unable to generate a list of queued tasks at this time.

QueueTask(Task)

Queues a Task to the scheduler.

protected override void QueueTask(Task task)

Parameters

task Task

The Task to be queued.

Exceptions

ArgumentNullException

The task argument is null.

TryExecuteTaskInline(Task, bool)

Determines whether the provided Task can be executed synchronously in this call, and if it can, executes it.

protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)

Parameters

task Task

The Task to be executed.

taskWasPreviouslyQueued bool

A Boolean denoting whether or not task has previously been queued. If this parameter is True, then the task may have been previously queued (scheduled); if False, then the task is known not to have been queued, and this call is being made in order to execute the task inline without queuing it.

Returns

bool

A Boolean value indicating whether the task was executed inline.

Exceptions

ArgumentNullException

The task argument is null.

InvalidOperationException

The task was already executed.