mscorlib(4.0.0.0) API with additions
|
Provides a pool of threads that can be used to execute tasks, post work items, process asynchronous I/O, wait on behalf of other threads, and process timers. More...
Static Public Member Functions | |
static bool | SetMaxThreads (int workerThreads, int completionPortThreads) |
Sets the number of requests to the thread pool that can be active concurrently. All requests above that number remain queued until thread pool threads become available. More... | |
static void | GetMaxThreads (out int workerThreads, out int completionPortThreads) |
Retrieves the number of requests to the thread pool that can be active concurrently. All requests above that number remain queued until thread pool threads become available. More... | |
static bool | SetMinThreads (int workerThreads, int completionPortThreads) |
Sets the minimum number of threads the thread pool creates on demand, as new requests are made, before switching to an algorithm for managing thread creation and destruction. More... | |
static void | GetMinThreads (out int workerThreads, out int completionPortThreads) |
Retrieves the minimum number of threads the thread pool creates on demand, as new requests are made, before switching to an algorithm for managing thread creation and destruction. More... | |
static void | GetAvailableThreads (out int workerThreads, out int completionPortThreads) |
Retrieves the difference between the maximum number of thread pool threads returned by the M:System.Threading.ThreadPool.GetMaxThreads(System.Int32@,System.Int32@) method, and the number currently active. More... | |
static RegisteredWaitHandle | RegisterWaitForSingleObject (WaitHandle waitObject, WaitOrTimerCallback callBack, object state, uint millisecondsTimeOutInterval, bool executeOnlyOnce) |
Registers a delegate to wait for a T:System.Threading.WaitHandle, specifying a 32-bit unsigned integer for the time-out in milliseconds. More... | |
static RegisteredWaitHandle | UnsafeRegisterWaitForSingleObject (WaitHandle waitObject, WaitOrTimerCallback callBack, object state, uint millisecondsTimeOutInterval, bool executeOnlyOnce) |
Registers a delegate to wait for a T:System.Threading.WaitHandle, specifying a 32-bit unsigned integer for the time-out in milliseconds. This method does not propagate the calling stack to the worker thread. More... | |
static RegisteredWaitHandle | RegisterWaitForSingleObject (WaitHandle waitObject, WaitOrTimerCallback callBack, object state, int millisecondsTimeOutInterval, bool executeOnlyOnce) |
Registers a delegate to wait for a T:System.Threading.WaitHandle, specifying a 32-bit signed integer for the time-out in milliseconds. More... | |
static RegisteredWaitHandle | UnsafeRegisterWaitForSingleObject (WaitHandle waitObject, WaitOrTimerCallback callBack, object state, int millisecondsTimeOutInterval, bool executeOnlyOnce) |
Registers a delegate to wait for a T:System.Threading.WaitHandle, using a 32-bit signed integer for the time-out in milliseconds. This method does not propagate the calling stack to the worker thread. More... | |
static RegisteredWaitHandle | RegisterWaitForSingleObject (WaitHandle waitObject, WaitOrTimerCallback callBack, object state, long millisecondsTimeOutInterval, bool executeOnlyOnce) |
Registers a delegate to wait for a T:System.Threading.WaitHandle, specifying a 64-bit signed integer for the time-out in milliseconds. More... | |
static RegisteredWaitHandle | UnsafeRegisterWaitForSingleObject (WaitHandle waitObject, WaitOrTimerCallback callBack, object state, long millisecondsTimeOutInterval, bool executeOnlyOnce) |
Registers a delegate to wait for a T:System.Threading.WaitHandle, specifying a 64-bit signed integer for the time-out in milliseconds. This method does not propagate the calling stack to the worker thread. More... | |
static RegisteredWaitHandle | RegisterWaitForSingleObject (WaitHandle waitObject, WaitOrTimerCallback callBack, object state, TimeSpan timeout, bool executeOnlyOnce) |
Registers a delegate to wait for a T:System.Threading.WaitHandle, specifying a T:System.TimeSpan value for the time-out. More... | |
static RegisteredWaitHandle | UnsafeRegisterWaitForSingleObject (WaitHandle waitObject, WaitOrTimerCallback callBack, object state, TimeSpan timeout, bool executeOnlyOnce) |
Registers a delegate to wait for a T:System.Threading.WaitHandle, specifying a T:System.TimeSpan value for the time-out. This method does not propagate the calling stack to the worker thread. More... | |
static bool | QueueUserWorkItem (WaitCallback callBack, object state) |
Queues a method for execution, and specifies an object containing data to be used by the method. The method executes when a thread pool thread becomes available. More... | |
static bool | QueueUserWorkItem (WaitCallback callBack) |
Queues a method for execution. The method executes when a thread pool thread becomes available. More... | |
static bool | UnsafeQueueUserWorkItem (WaitCallback callBack, object state) |
Queues the specified delegate to the thread pool, but does not propagate the calling stack to the worker thread. More... | |
static unsafe bool | UnsafeQueueNativeOverlapped (NativeOverlapped *overlapped) |
Queues an overlapped I/O operation for execution. More... | |
static bool | BindHandle (IntPtr osHandle) |
Binds an operating system handle to the T:System.Threading.ThreadPool. More... | |
static bool | BindHandle (SafeHandle osHandle) |
Binds an operating system handle to the T:System.Threading.ThreadPool. More... | |
Provides a pool of threads that can be used to execute tasks, post work items, process asynchronous I/O, wait on behalf of other threads, and process timers.
Definition at line 14 of file ThreadPool.cs.
|
static |
Binds an operating system handle to the T:System.Threading.ThreadPool.
osHandle | An T:System.IntPtr that holds the handle. The handle must have been opened for overlapped I/O on the unmanaged side. |
true
if the handle is bound; otherwise, false
.T:System.Security.SecurityException | The caller does not have the required permission. |
Definition at line 551 of file ThreadPool.cs.
|
static |
Binds an operating system handle to the T:System.Threading.ThreadPool.
osHandle | A T:System.Runtime.InteropServices.SafeHandle that holds the operating system handle. The handle must have been opened for overlapped I/O on the unmanaged side. |
true
if the handle is bound; otherwise, false
.T:System.ArgumentNullException | osHandle is null . |
Definition at line 564 of file ThreadPool.cs.
|
static |
Retrieves the difference between the maximum number of thread pool threads returned by the M:System.Threading.ThreadPool.GetMaxThreads(System.Int32@,System.Int32@) method, and the number currently active.
workerThreads | The number of available worker threads. |
completionPortThreads | The number of available asynchronous I/O threads. |
Definition at line 65 of file ThreadPool.cs.
|
static |
Retrieves the number of requests to the thread pool that can be active concurrently. All requests above that number remain queued until thread pool threads become available.
workerThreads | The maximum number of worker threads in the thread pool. |
completionPortThreads | The maximum number of asynchronous I/O threads in the thread pool. |
Definition at line 32 of file ThreadPool.cs.
|
static |
Retrieves the minimum number of threads the thread pool creates on demand, as new requests are made, before switching to an algorithm for managing thread creation and destruction.
workerThreads | When this method returns, contains the minimum number of worker threads that the thread pool creates on demand. |
completionPortThreads | When this method returns, contains the minimum number of asynchronous I/O threads that the thread pool creates on demand. |
Definition at line 56 of file ThreadPool.cs.
|
static |
Queues a method for execution, and specifies an object containing data to be used by the method. The method executes when a thread pool thread becomes available.
callBack | A T:System.Threading.WaitCallback representing the method to execute. |
state | An object containing data to be used by the method. |
true
if the method is successfully queued; T:System.NotSupportedException is thrown if the work item could not be queued.T:System.NotSupportedException | The common language runtime (CLR) is hosted, and the host does not support this action. |
T:System.ArgumentNullException | callBack is null . |
Definition at line 278 of file ThreadPool.cs.
|
static |
Queues a method for execution. The method executes when a thread pool thread becomes available.
callBack | A T:System.Threading.WaitCallback that represents the method to be executed. |
true
if the method is successfully queued; T:System.NotSupportedException is thrown if the work item could not be queued.T:System.ArgumentNullException | callBack is null . |
T:System.NotSupportedException | The common language runtime (CLR) is hosted, and the host does not support this action. |
Definition at line 294 of file ThreadPool.cs.
|
static |
Registers a delegate to wait for a T:System.Threading.WaitHandle, specifying a 32-bit unsigned integer for the time-out in milliseconds.
waitObject | The T:System.Threading.WaitHandle to register. Use a T:System.Threading.WaitHandle other than T:System.Threading.Mutex. |
callBack | The T:System.Threading.WaitOrTimerCallback delegate to call when the waitObject parameter is signaled. |
state | The object passed to the delegate. |
millisecondsTimeOutInterval | The time-out in milliseconds. If the millisecondsTimeOutInterval parameter is 0 (zero), the function tests the object's state and returns immediately. If millisecondsTimeOutInterval is -1, the function's time-out interval never elapses. |
executeOnlyOnce | true to indicate that the thread will no longer wait on the waitObject parameter after the delegate has been called; false to indicate that the timer is reset every time the wait operation completes until the wait is unregistered. |
T:System.ArgumentOutOfRangeException | The millisecondsTimeOutInterval parameter is less than -1. |
Definition at line 82 of file ThreadPool.cs.
|
static |
Registers a delegate to wait for a T:System.Threading.WaitHandle, specifying a 32-bit signed integer for the time-out in milliseconds.
waitObject | The T:System.Threading.WaitHandle to register. Use a T:System.Threading.WaitHandle other than T:System.Threading.Mutex. |
callBack | The T:System.Threading.WaitOrTimerCallback delegate to call when the waitObject parameter is signaled. |
state | The object that is passed to the delegate. |
millisecondsTimeOutInterval | The time-out in milliseconds. If the millisecondsTimeOutInterval parameter is 0 (zero), the function tests the object's state and returns immediately. If millisecondsTimeOutInterval is -1, the function's time-out interval never elapses. |
executeOnlyOnce | true to indicate that the thread will no longer wait on the waitObject parameter after the delegate has been called; false to indicate that the timer is reset every time the wait operation completes until the wait is unregistered. |
T:System.ArgumentOutOfRangeException | The millisecondsTimeOutInterval parameter is less than -1. |
Definition at line 137 of file ThreadPool.cs.
|
static |
Registers a delegate to wait for a T:System.Threading.WaitHandle, specifying a 64-bit signed integer for the time-out in milliseconds.
waitObject | The T:System.Threading.WaitHandle to register. Use a T:System.Threading.WaitHandle other than T:System.Threading.Mutex. |
callBack | The T:System.Threading.WaitOrTimerCallback delegate to call when the waitObject parameter is signaled. |
state | The object passed to the delegate. |
millisecondsTimeOutInterval | The time-out in milliseconds. If the millisecondsTimeOutInterval parameter is 0 (zero), the function tests the object's state and returns immediately. If millisecondsTimeOutInterval is -1, the function's time-out interval never elapses. |
executeOnlyOnce | true to indicate that the thread will no longer wait on the waitObject parameter after the delegate has been called; false to indicate that the timer is reset every time the wait operation completes until the wait is unregistered. |
T:System.ArgumentOutOfRangeException | The millisecondsTimeOutInterval parameter is less than -1. |
Definition at line 180 of file ThreadPool.cs.
|
static |
Registers a delegate to wait for a T:System.Threading.WaitHandle, specifying a T:System.TimeSpan value for the time-out.
waitObject | The T:System.Threading.WaitHandle to register. Use a T:System.Threading.WaitHandle other than T:System.Threading.Mutex. |
callBack | The T:System.Threading.WaitOrTimerCallback delegate to call when the waitObject parameter is signaled. |
state | The object passed to the delegate. |
timeout | The time-out represented by a T:System.TimeSpan. If timeout is 0 (zero), the function tests the object's state and returns immediately. If timeout is -1, the function's time-out interval never elapses. |
executeOnlyOnce | true to indicate that the thread will no longer wait on the waitObject parameter after the delegate has been called; false to indicate that the timer is reset every time the wait operation completes until the wait is unregistered. |
T:System.ArgumentOutOfRangeException | The timeout parameter is less than -1. |
T:System.NotSupportedException | The timeout parameter is greater than F:System.Int32.MaxValue. |
Definition at line 224 of file ThreadPool.cs.
|
static |
Sets the number of requests to the thread pool that can be active concurrently. All requests above that number remain queued until thread pool threads become available.
workerThreads | The maximum number of worker threads in the thread pool. |
completionPortThreads | The maximum number of asynchronous I/O threads in the thread pool. |
true
if the change is successful; otherwise, false
. Definition at line 23 of file ThreadPool.cs.
|
static |
Sets the minimum number of threads the thread pool creates on demand, as new requests are made, before switching to an algorithm for managing thread creation and destruction.
workerThreads | The minimum number of worker threads that the thread pool creates on demand. |
completionPortThreads | The minimum number of asynchronous I/O threads that the thread pool creates on demand. |
true
if the change is successful; otherwise, false
.Definition at line 45 of file ThreadPool.cs.
|
static |
Queues an overlapped I/O operation for execution.
overlapped | The T:System.Threading.NativeOverlapped structure to queue. |
true
if the operation was successfully queued to an I/O completion port; otherwise, false
.Definition at line 473 of file ThreadPool.cs.
|
static |
Queues the specified delegate to the thread pool, but does not propagate the calling stack to the worker thread.
callBack | A T:System.Threading.WaitCallback that represents the delegate to invoke when a thread in the thread pool picks up the work item. |
state | The object that is passed to the delegate when serviced from the thread pool. |
true
if the method succeeds; T:System.OutOfMemoryException is thrown if the work item could not be queued.T:System.Security.SecurityException | The caller does not have the required permission. |
T:System.ApplicationException | An out-of-memory condition was encountered. |
T:System.OutOfMemoryException | The work item could not be queued. |
T:System.ArgumentNullException | callBack is null . |
Definition at line 312 of file ThreadPool.cs.
|
static |
Registers a delegate to wait for a T:System.Threading.WaitHandle, specifying a 32-bit unsigned integer for the time-out in milliseconds. This method does not propagate the calling stack to the worker thread.
waitObject | The T:System.Threading.WaitHandle to register. Use a T:System.Threading.WaitHandle other than T:System.Threading.Mutex. |
callBack | The delegate to call when the waitObject parameter is signaled. |
state | The object that is passed to the delegate. |
millisecondsTimeOutInterval | The time-out in milliseconds. If the millisecondsTimeOutInterval parameter is 0 (zero), the function tests the object's state and returns immediately. If millisecondsTimeOutInterval is -1, the function's time-out interval never elapses. |
executeOnlyOnce | true to indicate that the thread will no longer wait on the waitObject parameter after the delegate has been called; false to indicate that the timer is reset every time the wait operation completes until the wait is unregistered. |
T:System.Security.SecurityException | The caller does not have the required permission. |
Definition at line 100 of file ThreadPool.cs.
|
static |
Registers a delegate to wait for a T:System.Threading.WaitHandle, using a 32-bit signed integer for the time-out in milliseconds. This method does not propagate the calling stack to the worker thread.
waitObject | The T:System.Threading.WaitHandle to register. Use a T:System.Threading.WaitHandle other than T:System.Threading.Mutex. |
callBack | The delegate to call when the waitObject parameter is signaled. |
state | The object that is passed to the delegate. |
millisecondsTimeOutInterval | The time-out in milliseconds. If the millisecondsTimeOutInterval parameter is 0 (zero), the function tests the object's state and returns immediately. If millisecondsTimeOutInterval is -1, the function's time-out interval never elapses. |
executeOnlyOnce | true to indicate that the thread will no longer wait on the waitObject parameter after the delegate has been called; false to indicate that the timer is reset every time the wait operation completes until the wait is unregistered. |
T:System.ArgumentOutOfRangeException | The millisecondsTimeOutInterval parameter is less than -1. |
T:System.Security.SecurityException | The caller does not have the required permission. |
Definition at line 159 of file ThreadPool.cs.
|
static |
Registers a delegate to wait for a T:System.Threading.WaitHandle, specifying a 64-bit signed integer for the time-out in milliseconds. This method does not propagate the calling stack to the worker thread.
waitObject | The T:System.Threading.WaitHandle to register. Use a T:System.Threading.WaitHandle other than T:System.Threading.Mutex. |
callBack | The delegate to call when the waitObject parameter is signaled. |
state | The object that is passed to the delegate. |
millisecondsTimeOutInterval | The time-out in milliseconds. If the millisecondsTimeOutInterval parameter is 0 (zero), the function tests the object's state and returns immediately. If millisecondsTimeOutInterval is -1, the function's time-out interval never elapses. |
executeOnlyOnce | true to indicate that the thread will no longer wait on the waitObject parameter after the delegate has been called; false to indicate that the timer is reset every time the wait operation completes until the wait is unregistered. |
T:System.ArgumentOutOfRangeException | The millisecondsTimeOutInterval parameter is less than -1. |
T:System.Security.SecurityException | The caller does not have the required permission. |
Definition at line 202 of file ThreadPool.cs.
|
static |
Registers a delegate to wait for a T:System.Threading.WaitHandle, specifying a T:System.TimeSpan value for the time-out. This method does not propagate the calling stack to the worker thread.
waitObject | The T:System.Threading.WaitHandle to register. Use a T:System.Threading.WaitHandle other than T:System.Threading.Mutex. |
callBack | The delegate to call when the waitObject parameter is signaled. |
state | The object that is passed to the delegate. |
timeout | The time-out represented by a T:System.TimeSpan. If timeout is 0 (zero), the function tests the object's state and returns immediately. If timeout is -1, the function's time-out interval never elapses. |
executeOnlyOnce | true to indicate that the thread will no longer wait on the waitObject parameter after the delegate has been called; false to indicate that the timer is reset every time the wait operation completes until the wait is unregistered. |
T:System.ArgumentOutOfRangeException | The timeout parameter is less than -1. |
T:System.NotSupportedException | The timeout parameter is greater than F:System.Int32.MaxValue. |
T:System.Security.SecurityException | The caller does not have the required permission. |
Definition at line 252 of file ThreadPool.cs.