Add-Ons & Services

ThreadPool capacity changes

Please post support and help requests here.
Posts: 5
Joined: 13 Dec 2007, 12:23
Location: Belgium

ThreadPool capacity changes

Postby dvk » 26 Mar 2008, 15:52

I am experimenting with a TCPServer and a ThreadPool object I give it in the constructor. I try to change the capacity of the ThreadPool when the TCPServer is already started, but
when I read the value of the TCPServerParams getMaxThreads it is not updated.

I was wondering if the TCPServerDispatcher doesn't use the changed capacity of the threadpool, or the params simply aren't updated correctly?

Posts: 1181
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: ThreadPool capacity changes

Postby guenter » 26 Mar 2008, 17:09

The capacity of the thread pool and the max threads parameter in TCPServerParams are independent of each other. The max threads param merely specifies how many threads from the thread pool the TCP server is allowed to use. However, you have to ensure that the thread pool provides at least as many threads as the TCP server might use.

Posts: 5
Joined: 13 Dec 2007, 12:23
Location: Belgium

Re: ThreadPool capacity changes

Postby dvk » 27 Mar 2008, 11:54

Thank you for the clarification.

To summarize :

By default the entire ThreadPool is used (if you don't specify your own TCPServerParams for the TCPServer because MaxThreads is 0 by default)
If you want to increase the used threads later on during the run of the TCPServer, you need to set the new amount on both :

pThreadPool->addCapacity(amount - pThreadPool->capacity());


Return to “Support”

Who is online

Users browsing this forum: No registered users and 1 guest