set_max_threads


Description:

public void set_max_threads (int max_threads) throws ThreadError

Sets the maximal allowed number of threads for this.

A value of -1 means that the maximal number of threads is unlimited. If this is an exclusive thread pool, setting the maximal number of threads to -1 is not allowed.

Setting max_threads to 0 means stopping all work for this. It is effectively frozen until max_threads is set to a non-zero value again.

A thread is never terminated while calling func, as supplied by ThreadPool.with_owned_data. Instead the maximal number of threads only has effect for the allocation of new threads in add. A new thread is allocated, whenever the number of currently running threads in this is smaller than the maximal number.

throws can be null to ignore errors, or non-null to report errors. An error can only occur when a new thread couldn't be created.

Before version 2.32, this function did not return a success status.

Parameters:

this

a ThreadPool

max_threads

a new maximal number of threads for this, or -1 for unlimited

Returns:

true on success, false if an error occurred