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

控制EpollWait的msec优势在哪? #128

Open
M6ZeroG opened this issue Oct 30, 2022 · 0 comments
Open

控制EpollWait的msec优势在哪? #128

M6ZeroG opened this issue Oct 30, 2022 · 0 comments

Comments

@M6ZeroG
Copy link

M6ZeroG commented Oct 30, 2022

gev/poller/epoll.go

Lines 145 to 156 in 16e310c

for {
n, err := unix.EpollWait(ep.fd, events, msec)
if err != nil && err != unix.EINTR {
log.Error("EpollWait: ", err)
continue
}
if n <= 0 {
msec = -1
runtime.Gosched()
continue
}
msec = 0

阻塞的EpollWait调用在阻塞线程时应该也会主动让出CPU吧,看上去效果和上面runtime.Gosched() 的效果一样。还是说这里有什么神奇操作。

@M6ZeroG M6ZeroG changed the title 控制EpollWait的msec的优势在哪? 控制EpollWait的msec优势在哪? Oct 30, 2022
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

1 participant