문제

What's the basic structure of a event loop system in C++11? How are the key elements (such as message queue, message dispatcher, signal) implemented? For example, do I still need a std::queue<Message>, a std::mutex and a std::condition_variable as what I did in c++98 + boost way? Also, the performance matters in the solution I'm seeking for.

도움이 되었습니까?

해결책

Do it roughly the same way you would have done it in C++98. You can replace some platform-specific things like pthread_t, pthread_mutex, and pthread_cond with standardized equivalents (std::thread, std::{recursive_,}{timed_,}mutex, and std::condition_variable{,_any}), but the basic design is the same.

As @beerboy mentioned, Boost.Asio might be a good place to start even though AFAIK it hasn't been updated for C++11 yet.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top