thread_pool_executor |
The os_thread_pool_executor
class implements the thread pool execution concurrency strategy. It uses the os_thread_pool
class for its implementation. The execute()
member function enqueues the handler for execution by a thread pool. The void*
run() method of the handler is executed by the next available idle
thread in the pool. Refer to os_thread_pool class
for more information on thread pools. This class can be used to execute
handlers in the os_tcp_acceptor and os_tcp_connector
classes.
Use of member template feature in the execute method gives the flexibility of not having the handler classes to inherit from a specific runnable interface class. Therefore, the compiler must be able to support member templates and OS_ENABLE_MEMBER_TEMPLATE_FEATURES must be defined to use this class.
Framework<ToolKit>
#include <ospace/framework/executor.h>
class os_thread_pool_executor : public os_thread_pool
100 ). The maximum number of idle
threads the pool can cache is set to max_idle_threads
(default 10 ). Any threads that become idle
after the max_idle_threads limit is reached are
kept for keep_alive_time milliseconds before they
are discarded. If keep_alive_time is 0
(default), then any extra threads that become idle after the max_idle_threads
limit is reached are discarded immediately.void* run()
method of handler will be called by the next free
thread.Copyright©1994-2026 Recursion
Software LLC
All Rights Reserved - For use by licensed users only.