ShellBrowser .Net Edition
WorkerThreadPool Class
NamespacesJam.ShellWorkerThreadPool
A thread pool that manages work items, in contrast to the common .net threadpool, threads managed by this pool may perform calls to COM objects.
Declaration Syntax
C#Visual BasicVisual C++
public class WorkerThreadPool
Public Class WorkerThreadPool
public ref class WorkerThreadPool
Members
All MembersConstructorsMethodsPropertiesFieldsEvents



IconMemberDescription
WorkerThreadPool()()()
Standard constructor, initializes a threadpool without support for COM.

WorkerThreadPool(Boolean)
Constructor

AbortThreadsExceedingMaxBusyTime()()()
This method removes threads from the busy pool if the maximum busy time is exceeded. Additionally if the thread is being stopped, if it doesn't join within 100ms abort is signalled via Abort()()().

AddWorkItem(IWorkItem)
Adds a work item to the internal queue but and immediately starts processing the item, see also AddWorkItem(IWorkItem, Boolean) and StartProcessing()()().

AddWorkItem(IWorkItem, Boolean)
Adds a work item to the internal queue but does not yet start processing them, see StartProcessing()()() for that.

AllWorkItemsDone
This event occurs if the threads finished processing all workitems, it happens from a different thread context. So do not perform gui operations directly.

CheckAddNewWorkerThread()()()
Determines whether new threads should be spawned, ensures that MinWorkerThreads threads are available for processing

CheckDisposed()()()
Call this method to check if the thread pool is still available,

Dispose()()()
Call this method to clean up all threads from the pool, in that case the ThreadPool instance cannot be used anymore, calls to functions of it will result in an ObjectDisposedException

Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Finalize()()()
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
GetCpuUsage()()()
Determines the overall cpu usage of the current process

GetHashCode()()()
Serves as a hash function for a particular type.
(Inherited from Object.)
GetType()()()
Gets the Type of the current instance.
(Inherited from Object.)
Instance
Get a lazy initialized singleton instance of WorkerThreadPool (thread-safe). Per default the Threadpool is prepared for usage with COM, see InstanceInitializesCOM.

InstanceInitializesCOM
Whether the threadpool returned by Instance initializes to let the threads in the pool make use of COM objects. The default value is true.

InstanceUsesLIFO
Whether the threadpool returned by Instance uses LIFO, the default value is false

m_InitializeCOM
Whether the threads are prepared to perform calls to COM objects

MaxBusyTime
The maximum time a thread may be busy unil it is aborted

MaxCpuUsage
The maximum cpu usage in percent were spawning additional worker threads is allowed

MaxIdleTime
The maximum time a thread may be idle until it is removed from the pool if more that MinWorkerThreads are available

MaxWorkerThreads
The maximum number of worker threads the pool may allocate

MemberwiseClone()()()
Creates a shallow copy of the current Object.
(Inherited from Object.)
MinWorkerThreads
The minimum number of worker threads

NewWorkItemEvent
This event occurs if a new work item begins to process

OnAllWorkItemsDone()()()
Issues the AllWorkItemsDone event

Paused
If this property is set to true the processing of new work items is paused, if it is set to false, processing is resumed. Getter and setter of this method are thread safe.

QueryCpuUsage
If this property is set to true, the threadpool queries the current overall cpu load to determine whether to start additional threads that process the work items. . The default value for this setting is true.

QueueLength
Returns the number of work items residing in the queue waiting to get processed by the next free thread

QueueUserWorkItem<(Of <(T>)>)(Action<(Of <(T>)>))
Adds an Action<(Of <(T>)>) delegate call to the work item queue

QueueUserWorkItem<(Of <(T>)>)(Action<(Of <(T>)>), T)
Adds an Action<(Of <(T>)>) delegate call to the work item queue

QueueUserWorkItem(WaitCallback)
Adds a user work item to the Threadpool that is immediately being processed

QueueUserWorkItem(WaitCallback, Object)
Adds a user work item to the Threadpool that is immediately being processed

QueueUserWorkItem(WaitCallback, Object, Int32)
Adds a user work item to the Threadpool that is immediately being processed and tagged with the given handle

RemoveThreadsExceedingMaxIdleTime()()()
This method removes threads from the idle pool where the maximum idle time is exceeded. This method does nothing if only MinWorkerThreads are active

StartProcessing()()()
Start processing the work items (AddWorkItem(IWorkItem, Boolean))

Terminated
Returns true if processing was terminated via TerminateProcessing()()() or TerminateProcessing(Boolean). Is reset to false in a call to StartProcessing()()().

TerminateProcessing()()()
Stops processing work items that are queued

TerminateProcessing(Boolean)
Stops processing the threads. If

TerminateWorkItemsForTag(Int32)
Removes all pending work items from the work queue having the tag specified

TerminateWorkItemsForType(Type)
Removes all pending work items of type 'type'

ToString()()()
Returns a String that represents the current Object.
(Inherited from Object.)
UseLIFO
If set to False, the oldest work item in the queue will be used a next item. This is the default value. If set to True, the newest work item in the queue will be used as next work item. True can be a good setting if the number of work items is large and their order doesn't matter

WaitFinish()()()
Waits until all threads finished processing (the workitem queue is empty)

WaitFinish(Int32)
Waits until all threads finished processing (the workitem queue is empty)

WorkItemsCount
Returns the number of work items that still need to be processed

Inheritance Hierarchy
Object
WorkerThreadPool

Assembly: ShellBrowser (Module: ShellBrowser) Version: 4.2.1.45 (4.2.1.45)