-
Notifications
You must be signed in to change notification settings - Fork 4k
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
EventDispatcher支持不同类型fd #2381
Labels
feature
new feature
Comments
用bthread_fd_wait、bthread_fd_timedwait应该就能满足需求了吧 |
看这个函数的注释,每次都要EPOLL_CTL_ADD and EPOLL_CTL_DEL,对性能有影响?我这个需求是注册上去了,后边就一直监听就可以了。 |
这样看起来不太适用 |
是不是可以将Socket中id、on_edge_triggered_events抽象到一个基类?Socket继承这个基类并实现对应的方法。有其他需求的话,就继承这个基类就好。 |
嗯,我觉得这样是可以的 |
@yanglimingcn 有空看看,提了个PR支持这个feature #2560 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? (你需要的功能是否与某个问题有关?)
Describe the solution you'd like (描述你期望的解决方法)
现在brpc监听的都是socket fd,对于socket fd的处理都是OnNewMessages。有时候我们的服务需要监听一些其它类型的文件描述符,比如eventfd,然后通过eventfd来做一些逻辑,OnNewEvents。这块能否做一些扩展呢?让用户能向EventDispatcher注册这些fd并且实现自己的事件处理CallBack。
实现上,可能可以加一个Socket::DummyCreate(const SocketOptions& options, SocketId* id),SocketOptions里面填入自己的on_edge_triggered_events CallBack和对应的eventfd
Describe alternatives you've considered (描述你想到的折衷方案)
Additional context/screenshots (更多上下文/截图)
The text was updated successfully, but these errors were encountered: