This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import fcntl | |
from gevent.core import wait_read, wait_write | |
class GeventFD(object): | |
""" Wrap a file descriptor so it can be used for non-blocking reads and writes with gevent. | |
>>> stdin = GeventFD(sys.stdin.fileno()) | |
>>> stdin.read(5) | |
'hello' |
NewerOlder