Can one small portion of an app use gevent, or does the whole app have to switch over?

被刻印的时光 ゝ 提交于 2019-12-06 11:47:10

It is not recommended. The docs say nothing about thread safety guarantees between stuff done on greenlets and stuff done on normal threads. It does not appear that this behavior is supported and there is not much online when you search for problems you will run into.

You will see weird behavior and errors in the interaction between the two.

For example if you put something into a gevent.Queue from a normal thread it may take many seconds for the gevent thread to notice something is in there.

You can selectively monkey patch as seen here. That might work for you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!