23.Share Thread Pool that has same host module in a server.

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.

그림 23-1Example of sharing same Thread Pool with other host module in a server.

Please write applicaion to excute 'Share Thread Pool with host modules in a server.

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.