// Wait until data can be read without blocking.
size_t read_some(implementation_type& impl,
const null_buffers&, asio::error_code& ec)
{
// Wait for descriptor to become ready.
descriptor_ops::poll_read(impl.descriptor_, ec);
return 0;
}
在descriptor_ops里面
int poll_read(int d, asio::error_code& ec)
{
if (d == -1)
{
ec = asio::error::bad_descriptor;
return -1;
}
pollfd fds;
fds.fd = d;
fds.events = POLLIN;
fds.revents = 0;
errno = 0;
int result = error_wrapper(::poll(&fds, 1, -1), ec);
if (result >= 0)
ec = asio::error_code();
return result;
}
pollfd
,原型在哪里定义?::poll
指的是哪个文件的民意调查?ioctl
,fcntl
适用于unix 和window 系统?const null_buffers&
,传递对 null_buffer 的引用有什么用?
谢谢