Ejemplo n.º 1
0
void
ALSAPCMPlayer::OnReadEvent(boost::asio::posix::stream_descriptor &fd,
                       const boost::system::error_code &ec) {
  if (ec == boost::asio::error::operation_aborted)
    return;

  if (OnEvent())
    fd.async_read_some(boost::asio::null_buffers(),
                       std::bind(&ALSAPCMPlayer::OnReadEvent,
                                 this,
                                 std::ref(fd),
                                 std::placeholders::_1));
  else
    StopEventHandling();
}
void Monitor::run()
{
    TRACE() << "Starting input monitoring\n";
    using boost::system::error_code;
    auto on_event = [this](error_code ec, std::size_t) {
        if (ec) {
            TRACE() << "asio err " << ec << std::endl;
            io_.stop();
            return;
        }
        if (on_device_(mon_.device(root_)) == Action::Poll)
            async_read_();
    };
    using namespace std::placeholders;
    auto event_wrapper = std::bind
        (cor::error_trace_nothrow
         <decltype(on_event), error_code, std::size_t>
         , on_event, _1, _2);
    async_read_ = [this, event_wrapper]() {
        stream_.async_read_some(asio::null_buffers(), event_wrapper);
    };
    async_read_();
}
Ejemplo n.º 3
0
 void AsyncRead() {
   asio.async_read_some(boost::asio::null_buffers(),
                        std::bind(&SignalListener::OnReadReady, this,
                                  std::placeholders::_1));
 }
Ejemplo n.º 4
0
 void AsyncRead() {
   asio.async_read_some(boost::asio::null_buffers(),
                        std::bind(&X11EventQueue::OnReadReady, this,
                                  std::placeholders::_1));
 }