boost::asio序列3: execution_context

函數名稱    

void notify_fork(fork_event event)

enum fork_event

{

/// Notify the context that the process is about to fork.

fork_prepare,

 

/// Notify the context that the process has forked and is the parent.

fork_parent,

 

/// Notify the context that the process has forked and is the child.

fork_child

};

 

template <typename Service>

friend Service& use_service(execution_context& e)

獲取execution_context對應的Service  

template <typename Service>

friend Service& use_service(io_context& ioc)

獲取execution_context對應的Service  

template <typename Service, typename... Args>

friend Service& make_service(execution_context& e,

BOOST_ASIO_MOVE_ARG(Args)... args)

創建Service,並且加入execution_context  

template <typename Service>

friend void add_service(execution_context& e, Service* svc)

將Service加入execution_context  

template <typename Service>

friend bool has_service(execution_context& e);

確定execution_context包含指定類型的Service  

void shutdown()

關閉execution_context中的全部services  

void destroy()

銷燬execution_context中的全部services  

execution_context::service: 表示和execution_context關聯的的service, 一個execution_context包含多個services

execution_context::id: 表示execution_context::service的唯一標識

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章