Commits

Denis Bilenko committed 4dc2930

socket: add wait_readwrite()

Comments (0)

Files changed (1)

         evt.cancel()
 
 
+def wait_readwrite(fileno, timeout=-1, timeout_exc=timeout):
+    evt = core.readwrite_event(fileno, _wait_helper, timeout, (getcurrent(), timeout_exc))
+    try:
+        switch_result = get_hub().switch()
+        assert evt is switch_result, 'Invalid switch into wait_readwrite(): %r' % (switch_result, )
+    finally:
+        evt.cancel()
+
+
 try:
     from OpenSSL import SSL
 except ImportError: