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.
Public Static Methods | |
static void | close () |
Close all resources and worker threads. | |
static void | get_available_threads (size_t &worker_threads, size_t &completion_port_threads) |
Retrieves the difference between the maximum number of thread pool threads returned by the GetMaxThreads method, and the number currently active. | |
static void | get_max_threads (size_t &worker_threads, size_t &completion_port_threads) |
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. | |
static void | get_min_threads (size_t &worker_threads, size_t &completion_port_threads) |
Retrieves the number of idle threads the thread pool maintains in anticipation of new requests. Always 0 for both. | |
static void | join_all () |
Join all resources and worker threads. | |
static bool | join_all (int32 milliseconds_timeout) |
Join all resources and worker threads. | |
static bool | join_all (const time_span &timeout) |
Join all resources and worker threads. | |
static bool | queue_user_work_item (const wait_callback &callback) |
Queues a method for execution. The method executes when a thread pool thread becomes available. | |
static bool | queue_user_work_item (const wait_callback &callback, std::any state) |
Queues a method for execution. The method executes when a thread pool thread becomes available. | |
static registered_wait_handle | register_wait_for_single_object (wait_handle &wait_object, const wait_or_timer_callback &callback, std::any state, int32 milliseconds_timeout_interval, bool execute_only_once) |
Registers a delegate to wait for a xtd::threading::wait_handle, specifying a 32-bit signed integer for the time-out in milliseconds. | |
static registered_wait_handle | register_wait_for_single_object (wait_handle &wait_object, const wait_or_timer_callback &callback, std::any state, int64 milliseconds_timeout_interval, bool execute_only_once) |
Registers a delegate to wait for a xtd::threading::wait_handle, specifying a 32-bit signed integer for the time-out in milliseconds. | |
static registered_wait_handle | register_wait_for_single_object (wait_handle &wait_object, const wait_or_timer_callback &callback, std::any state, const time_span &timeout, bool execute_only_once) |
Registers a delegate to wait for a xtd::threading::wait_handle, specifying a 32-bit signed integer for the time-out in milliseconds. | |
static registered_wait_handle | register_wait_for_single_object (wait_handle &wait_object, const wait_or_timer_callback &callback, std::any state, uint32 milliseconds_timeout_interval, bool execute_only_once) |
Registers a delegate to wait for a xtd::threading::wait_handle, specifying a 32-bit signed integer for the time-out in milliseconds. | |
static bool | set_max_threads (size_t worker_threads, size_t completion_port_threads) |
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. | |
static bool | set_min_threads (size_t worker_threads, size_t completion_port_threads) |
Sets the number of idle threads the thread pool maintains in anticipation of new requests. | |
|
static |
Close all resources and worker threads.
|
static |
Retrieves the difference between the maximum number of thread pool threads returned by the GetMaxThreads method, and the number currently active.
worker_threads | The number of available worker threads |
completion_port_threads | The number of available asynchronous I/O threads. |
|
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.
worker_threads | The maximum number of worker threads in the thread pool. |
completion_port_threads | The maximum number of asynchronous I/O threads in the thread pool. |
|
static |
Retrieves the number of idle threads the thread pool maintains in anticipation of new requests. Always 0 for both.
worker_threads | The maximum number of worker threads in the thread pool. |
completion_port_threads | The maximum number of asynchronous I/O threads in the thread pool. |
|
static |
Join all resources and worker threads.
|
static |
Join all resources and worker threads.
milliseconds_timeout | The number of milliseconds to wait for all threads to terminate. |
|
static |
Join all resources and worker threads.
timeout | A xtd::time_span set to the amount of time to wait for all threads to terminate. |
|
static |
Queues a method for execution. The method executes when a thread pool thread becomes available.
callback | A pointer function that represents the method to be executed. |
|
static |
Queues a method for execution. The method executes when a thread pool thread becomes available.
callback | A pointer function that represents the method to be executed. |
state | An object containing data to be used by the method. |
|
static |
Registers a delegate to wait for a xtd::threading::wait_handle, specifying a 32-bit signed integer for the time-out in milliseconds.
wait_object | The xtd::threading::wait_handle to register. Use a xtd::threading::wait_handle other than Mutex |
callback | A pointer function to call when the wait_object parameter is signaled. |
state | The object that is passed to the callback. |
milliseconds_timeout_interval | The time-out in milliseconds. If the milliseconds_timeout_interval parameter is 0 (zero), the function tests the object's state and returns immediately. If milliseconds_timeout_interval is -1, the function's time-out interval never elapses. |
execute_only_once | true to indicate that the thread will no longer wait on the wait_object parameter after the callback has been called; false to indicate that the timer is reset every time the wait operation completes until the wait is unregistered. |
xtd::argument_out_of_range_exception | The milliseconds_timeout_interval parameter is less than -1. |
|
static |
Registers a delegate to wait for a xtd::threading::wait_handle, specifying a 32-bit signed integer for the time-out in milliseconds.
wait_object | The xtd::threading::wait_handle to register. Use a xtd::threading::wait_handle other than Mutex |
callback | A pointer function to call when the wait_object parameter is signaled. |
state | The object that is passed to the callback. |
milliseconds_timeout_interval | The time-out in milliseconds. If the milliseconds_timeout_interval parameter is 0 (zero), the function tests the object's state and returns immediately. If milliseconds_timeout_interval is -1, the function's time-out interval never elapses. |
execute_only_once | true to indicate that the thread will no longer wait on the wait_object parameter after the callback has been called; false to indicate that the timer is reset every time the wait operation completes until the wait is unregistered. |
xtd::argument_out_of_range_exception | The milliseconds_timeout_interval parameter is less than -1. |
|
static |
Registers a delegate to wait for a xtd::threading::wait_handle, specifying a 32-bit signed integer for the time-out in milliseconds.
wait_object | The xtd::threading::wait_handle to register. Use a xtd::threading::wait_handle other than Mutex |
callback | A pointer function to call when the wait_object parameter is signaled. |
state | The object that is passed to the callback. |
timeout | The time-out represented by a time_span.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. |
execute_only_once | true to indicate that the thread will no longer wait on the wait_object parameter after the callback has been called; false to indicate that the timer is reset every time the wait operation completes until the wait is unregistered. |
xtd::argument_out_of_range_exception | The milliseconds_timeout_interval parameter is less than -1. |
|
static |
Registers a delegate to wait for a xtd::threading::wait_handle, specifying a 32-bit signed integer for the time-out in milliseconds.
wait_object | The xtd::threading::wait_handle to register. Use a xtd::threading::wait_handle other than Mutex |
callback | A pointer function to call when the wait_object parameter is signaled. |
state | The object that is passed to the callback. |
milliseconds_timeout_interval | The time-out in milliseconds. If the milliseconds_timeout_interval parameter is 0 (zero), the function tests the object's state and returns immediately. If milliseconds_timeout_interval is -1, the function's time-out interval never elapses. |
execute_only_once | true to indicate that the thread will no longer wait on the wait_object parameter after the callback has been called; false to indicate that the timer is reset every time the wait operation completes until the wait is unregistered. |
xtd::argument_out_of_range_exception | The milliseconds_timeout_interval parameter is less than -1. |
|
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.
worker_threads | The maximum number of worker threads in the thread pool. |
completion_port_threads | The maximum number of asynchronous I/O threads in the thread pool. |
|
static |
Sets the number of idle threads the thread pool maintains in anticipation of new requests.
worker_threads | The new minimum number of idle worker threads to be maintained by the thread pool. |
completion_port_threads | The new minimum number of idle asynchronous I/O threads to be maintained by the thread pool. |