Each thread group has a thread count, which determines how many threads can run simultaneously. The count can be:
Run interval |
Meaning |
---|---|
-1 (the default) |
There is no limit. |
A positive integer n |
n threads can execute. |
0 |
No threads can execute. |
To change the thread count, call the ThreadManager::setThreadCount method. The change takes effect after threads return from the run method. Thread counts are useful if threads run repeatedly (run interval is positive or 0). For example, if 6 threads are running, and you change the count to 5, the next thread that returns from its run method will not be restarted. The thread count provides a means to throttle the number of running threads, without stopping or suspending all threads.