简体   繁体   中英

Message Passing with boost::threads?

Does boost have some kind of way to make message passing accross multiple threads?

I'm working on a server application and I want to be able to pass on messages throughout the application in a safe way.

Thanks

您也可以为此使用Boost.Asio:在一个线程中运行io_service,然后从另一个线程中调用io_service_.post(yourFunctor)。

boost::thread provides the tools you will need, and there is a sample queue implementation here that should get you started.

This also gives me another opportunity to plug this book.

C++ Concurrency in Action is a reference and guide to the new C++ 11 Standard for experienced C++ programmers as well as those who have never written multithreaded code. This book will show you how to write robust multithreaded applications in C++ while avoiding many common pitfalls.

If you are using Windows Visual C++ 10 has some proprietary tools of use here in the Concurrency Runtime . VC11 expands on this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM