Why does Boost.Asio not support an event-based interface?

前端 未结 2 1072
天命终不由人
天命终不由人 2020-12-01 05:00

I am attempting to understand Boost.Asio, with the intention of potentially implementing a signaling system using condition variables in conjunction with Boost.Asio.

2条回答
  •  一整个雨季
    2020-12-01 05:20

    Condition variables are a synchronous concept: they block one thread until something happens in another thread. Boost.Asio is an asynchronous framework: it provides multiplexing of events in a non-blocking fashion. These two don't seem very compatible. If you want asynchronous event notification, look at eventfd on Linux, which should be usable with Boost.Asio.

提交回复
热议问题