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

用timerfd实现非阻塞的sleep()/usleep()/nanosleep() #30

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yueshuaijie
Copy link

我用到的一个c库除了网络IO block,还有sleep()等其他block,所以我fork了greenify来实现非阻塞的sleep。原理是把常用的sleep()函数替换为timerfd,加入事件循环,监听read()。
(未解决信号中断sleep的问题)

用法:patch_lib()增加了个默认参数:patch_sleep=False,默认不patch sleep()
如需patch:
greenify.patch_lib('/usr/lib/libmemcached.so', patch_sleep=True)

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

Successfully merging this pull request may close these issues.

1 participant