Skip to content
New issue

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

runinloop问题 #141

Open
miku-fan opened this issue Aug 9, 2022 · 1 comment
Open

runinloop问题 #141

miku-fan opened this issue Aug 9, 2022 · 1 comment

Comments

@miku-fan
Copy link

miku-fan commented Aug 9, 2022

HttpData.cpp 的 handleConn() 函数中:

loop_->runInLoop(bind(&HttpData::handleClose, shared_from_this()));

这里用 runinloop 真的有必要吗,因为这里loop_ 就是 HttpData 内指向本 eventloop 的指针,可以确定是在本线程(eventloop)执行的吧。所以跟直接调用 handleClose() 有什么区别?

@linyacool
Copy link
Owner

可以直接调的,用runInLoop的原因只是因为这样不用动脑,并且一定不会错,follow自己的风格就好了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants