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_(); }
void AsyncRead() { asio.async_read_some(boost::asio::null_buffers(), std::bind(&SignalListener::OnReadReady, this, std::placeholders::_1)); }
void AsyncRead() { asio.async_read_some(boost::asio::null_buffers(), std::bind(&X11EventQueue::OnReadReady, this, std::placeholders::_1)); }