IronsDu / brynet

A Header-Only cross-platform C++ TCP network library . We can use vcpkg(https://github.com/Microsoft/vcpkg/tree/master/ports/brynet) install brynet.
MIT License
1.05k stars 241 forks source link

Question to API “service->startWorkerThread(xxx)” #109

Open eeyrw opened 2 years ago

eeyrw commented 2 years ago

Is this API to set the capacity of internal thread pool? Furthermore, how does the brynet schedule the multiple tcp clients to these threads? Such as num of clients greater than num of threads.

IronsDu commented 2 years ago
  1. this API set the number of IO thread. (so, not a capacity)
  2. One client is processed in one changeless IO thread. It initialized in https://github.com/IronsDu/brynet/blob/master/include/brynet/net/detail/TCPServiceDetail.hpp#L96 by random.
eeyrw commented 2 years ago

Got it. Thank you.