void myqtt_thread_pool_setup ( MyQttCtx ctx,
int  thread_max_limit,
int  thread_add_step,
int  thread_add_period,
axl_bool  auto_remove 

Allows to configure thread pool with several parameters to react to working peaks on thread in pool.

By default, thread pool has a number of threads that are used to dispatch work generated by the engine (especially msg received).

In the case more work is received than available workers on the pool, then these work is queued as pending tasks (internally at thread pools queue).

However, in the case it is required to make the myqtt engine to react to working peaks adding more threads to the pool, this function can be used.

ctxThe context where the thread pool to be configured resides.
thread_max_limitMax thread limit (which is the upper number of threads that will never be exceeded.
thread_add_stepIn the case the engine detects there are not enough threads, how many thread add to the pool at once.
thread_add_periodThis is the adding period, that is, in the case threads are added to the pool, no additional add operation will happen until next thread_add_period. Period is measured in seconds. This value can also be seen as the period during which the thread pool must find all threads from the pool are working (busy) so he can start adding more threads (as defined by thread_add_step).
auto_removeIn the case axl_true is provided, the thread pool will remove threads added when it is detected no pending tasks are available, using thread_add_period as reference, and remove threads as provided by the thread_add_step variable. In the case axl_false is removed, no thread will be removed.

For example, in the case you want to add 1 thread each 5 seconds when a working peak is detected, setup thread_add_step=1 and thread_add_period=5.

To disable thread pool automatic add operation, do a call with thread_max_limit equal to -1. This will leave the engine with current threads created.

You can call to this function at any time to change current thread pool configuration.