We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
看了将近半天,也查了issue,我发现大家普遍对reactor提出了问题,认为主线程需要一直while轮询确保读写操作完成,状态码改变,好像阻塞在这了。
除此之外,我对proactor也同样有疑问,if (users[sockfd].read_once())的意思应该是主线程自己读取了数据吧,假如是ET的话还需要循环读取完才能返回结果,那读取数据产生的这段“等待”时间,是否也算是“阻塞”呢?
if (users[sockfd].read_once())
还是说因为proactor是基于同步IO模拟的,因此读数据的过程是同步,不算阻塞,只有等待数据准备的过程才算阻塞呢?
The text was updated successfully, but these errors were encountered:
所以我的理解是,如果把“读”划分为两个阶段:
是否“阻塞”代表的仅仅是第一阶段的不同,在bool http_conn::read_once()中ET虽然会循环读取,但当数据未准备好时,会有errno == EAGAIN || errno == EWOULDBLOCK,因此也算非阻塞;而假设数据准备好了,花在等待if (users[sockfd].read_once())返回结果的时间,也只能算是同步
bool http_conn::read_once()
errno == EAGAIN || errno == EWOULDBLOCK
不知道这样的理解对不对,希望大佬指点一下
Sorry, something went wrong.
No branches or pull requests
看了将近半天,也查了issue,我发现大家普遍对reactor提出了问题,认为主线程需要一直while轮询确保读写操作完成,状态码改变,好像阻塞在这了。
除此之外,我对proactor也同样有疑问,
if (users[sockfd].read_once())
的意思应该是主线程自己读取了数据吧,假如是ET的话还需要循环读取完才能返回结果,那读取数据产生的这段“等待”时间,是否也算是“阻塞”呢?还是说因为proactor是基于同步IO模拟的,因此读数据的过程是同步,不算阻塞,只有等待数据准备的过程才算阻塞呢?
The text was updated successfully, but these errors were encountered: