Click or drag to resize

ThreadBoundTaskScheduler Class

A TaskScheduler that queues the tasks an runs them in one dedicated thread.
Inheritance Hierarchy
SystemObject
  System.Threading.TasksTaskScheduler
    TomsToolbox.EssentialsThreadBoundTaskScheduler

Namespace:  TomsToolbox.Essentials
Assembly:  TomsToolbox.Essentials (in TomsToolbox.Essentials.dll)
Syntax
public sealed class ThreadBoundTaskScheduler : TaskScheduler, 
	IDisposable

The ThreadBoundTaskScheduler type exposes the following members.

Constructors
  NameDescription
Public methodThreadBoundTaskScheduler
Initializes a new instance of the ThreadBoundTaskScheduler class.
Top
Properties
  NameDescription
Public propertyTaskFactory
Gets the task factory that can be used to enqueue a new task.
Public propertyThreadId
Gets the thread identifier of the underlying thread.
Top
Methods
  NameDescription
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Top
Extension Methods
  NameDescription
Public Extension MethodCode exampleReportNotDisposedObject
Handle reporting of a not disposed object.

Using this pattern is a good practice to avoid code where disposable objects get never disposed.

Calling this method will raise the NotDisposedObject event if any event handler is attached; otherwise it will throw an InvalidOperationException if a debugger is attached. If the application does not run in a debugger and no event handler is attached, calling this method does nothing.

(Defined by Disposable.)
Public Extension MethodSafeCastT
Performs a cast from object to T, avoiding possible null violations if T is a value type.
(Defined by ObjectExtensions.)
Top
See Also