Crow:run的流程2 建立io_service及线程

void Server::run()
{
    uint16_t worker_thread_count = concurrency_ - 1;
    for (int i = 0; i < worker_thread_count; i++)
        io_service_pool_.emplace_back(new asio::io_service());
    get_cached_date_str_pool_.resize(worker_thread_count);
    task_timer_pool_.resize(worker_thread_count);
    ...
private:
    std::vector> io_service_pool_;
    std::vector> get_cached_date_str_pool_;
    std::vector task_timer_pool_;
}

run先获取worker线程数量,也就是真正处理http请求的线程数量

然后创建worker线程数量相同的io_service,并压入io_service_pool_

先不管get_cached_date_str_pool_和task_timer_pool_

void Server::run()
{
    ...
    std::vector> v;
    std::atomic init_count(0);
    for (uint16_t i = 0; i < work

你可能感兴趣的:(Crow,c++)