kingso 阿里开源搜索引擎,framework 源码分析
Command.cpp
CommandLine::run()
Args args(argc, argv);
_server = makeServer();
_server->start(args.getConfPath());
ini_load_from_file(path, &cfg);
_taskQueue = new (std::nothrow) TaskQueue;
initParallelLimitter(); //并发控制
_transport = new (std::nothrow) anet::Transport;
_cache = new (std::nothrow) MemcacheClient;
_webProbe = new WebProbe();
initWorkerFactory(worker_init_cfg);
ret = startThreads(maxThrCount, stackSize);
_thrPool = new UTIL::ThreadPool(maxThrCount, stackSize);
_disp = new (nothrow)Dispatcher(*_thrPool, *_taskQueue, *_workerFactory);
_disp->start();
pthread_create(&_tid, attr, thread_hook, this);
thr->run();
Dispatcher::run();
_taskQueue.dequeue(&session);
worker = _workerFactory.makeWorker(*session);
_thrPool.newThread(NULL, worker);
thr->dispatch(runner);
_server->wait();