CMainFrame构造---》CFileZillaEngineContex构造--》引起其成员变量lmpl构造--》引起fz::event_loop的构造,其中创建了两个线程(指针) task_和 timer_task_。
// In event_loop.cpp
event_loop::event_loop(thread_pool & pool): sync_(false)
{task_ = std::make_unique<async_task>(pool.spawn([this] { entry(); }));timer_task_ = std::make_unique<async_task>(pool.spawn([this] { timer_entry(); }));
}//In Mainfrm.h
class CMainFrame final : public wxNavigationEnabled<wxFrame>, public COptionChangeEventHandler
#if FZ_MANUALUPDATECHECK, protected CUpdateHandler
#endif
{
......CFileZillaEngineContext m_engineContext;
......
}//In engine_context.h
class FZC_PUBLIC_SYMBOL CFileZillaEngineContext final
{
......class Impl;std::unique_ptr<Impl> impl_;
......
}class CFileZillaEngineContext::Impl final
{
public:Impl(COptionsBase& options): options_(options), rate_limit_mgr_(loop_), tlsSystemTrustStore_(pool_){directory_cache_.SetTtl(fz::duration::from_seconds(options.get_int(OPTION_CACHE_TTL)));rate_limit_mgr_.add(&rate_limiter_);}~Impl(){}COptionsBase& options_;fz::thread_pool pool_;fz::event_loop loop_{pool_};// !!!!!!fz::rate_limit_manager rate_limit_mgr_;fz::rate_limiter rate_limiter_;option_change_handler option_change_handler_{options_, loop_, rate_limit_mgr_, rate_limiter_};CDirectoryCache directory_cache_;CPathCache path_cache_;OpLockManager opLockManager_;fz::tls_system_trust_store tlsSystemTrustStore_;activity_logger activity_logger_;
};
目前每次打开FileZilla就是四个线程,一个主线程及timer_entry()、timer_entry()和thread_entry()。
未完待续......