Usually server-side host module works in one process such as CLanServer, CLanClient, CNetServer. This server-side host module owned Thread pool that composed at least 1 thread.
However, you may want to share specific thread pool rather than those thread pool owned by each modules. This explain how you can do that.
Please write applicaion to excute 'Share Thread Pool with host modules in a server.
First, creates thread pool object clearly with Proud::CThreadPool::Create(). User creates thread pool manually.
If you want, connect event callback that occur from thread pool with Proud::CThreadPool::SetEventSink.
Then, activate thread pool with Proud::CThreadPool::Start
Then, send thread pool object with parameter of Proud::CNetServer::Start, Proud::CLanServer::Start, Proud::CLanClient::Connect
Do not user destruct created thread pool object before you destruct all server-side host modules. Otherwise it will occurs throw exception.
Example
Proud::CThreadPool* tp = Proud::CThreadPool::Create(); tp->SetEventSink(...); tp->Start(); Proud::CNetServer* server = Proud::ProudNet::CreateServer(); Proud::CStartServerParameter p; p.m_externalUserWorkerThreadPool = tp; ... server->Start(p);
Note:
sever-side host modules have user worker thread pool and networker thread pool. Normally it is refered to user created thread pool by user worker thread pool. However, networker thread pool can use user created thread pool to improve performance. For this case, methods that callback from user created thread pool have to finish processing as quick as possible. Otherwise, you will get wrong internal ping measurment or client will disconnect from server.