The BetterStreams Class Library
BackgroundThreadPriority Property
Namespaces > BetterStreams > AsyncStream > BackgroundThreadPriority
Retrieves or sets the priority for the background thread the AsyncStream uses for asychronous I/O.
Syntax
C#Visual BasicManaged C++
public virtual ThreadPriority BackgroundThreadPriority { get; set; }
Public Overridable Property BackgroundThreadPriority As ThreadPriority
public:
virtual property ThreadPriority BackgroundThreadPriority {
	ThreadPriority get ();
	void set (ThreadPriority value);
}
Remarks

By default the priority of the background thread is "normal". Operating systems are not required to honor thread priority levels, so this property may have no effect.

Higher priority levels ensure that the thread scheduler will select the background thread more quickly and more frequently and may result in better AsyncStream performance. Typically this has a negligable impact on other threads, since the background thread will spend most of its time blocking while performing I/O on the BaseStream and consume little CPU time before relinquishing the processor.

On the other hand, some streams (such as DeflateStream) require significant CPU time while performing I/O. When wrapping these, a high priority could allow the background thread to monopolize the processor at the expense of other threads, which may or may not be desirable.

Exceptions
ExceptionCondition
ObjectDisposedExceptionThe AsyncStream has already been closed
ArgumentExceptionAttempted to set to a value which is not a ThreadPriority

Assembly: BetterStreams (Module: BetterStreams) Version: 1.0.0.0