Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Unified Diff: mojo/public/python/mojo/system.pyx

Issue 573253002: mojo: Add async waiter for python bindings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation due to pre-processor variable Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/python/mojo/c_environment.pxd ('k') | mojo/public/python/src/python_system_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/python/mojo/system.pyx
diff --git a/mojo/public/python/mojo/system.pyx b/mojo/public/python/mojo/system.pyx
index 84fbfefef716e78b90a8f54b3774f53c2234bee3..4768247e695fcca555f565627786f725f9d59908 100644
--- a/mojo/public/python/mojo/system.pyx
+++ b/mojo/public/python/mojo/system.pyx
@@ -324,6 +324,19 @@ cdef class Handle(object):
result = c_core.MojoWait(handle, csignals, cdeadline)
return result
+ def AsyncWait(self, signals, deadline, callback):
+ cdef c_core.MojoHandle handle = self._mojo_handle
+ cdef c_core.MojoHandleSignals csignals = signals
+ cdef c_core.MojoDeadline cdeadline = deadline
+ cdef c_environment.MojoAsyncWaitID wait_id = _ASYNC_WAITER.AsyncWait(
+ handle,
+ csignals,
+ cdeadline,
+ callback)
+ def cancel():
+ _ASYNC_WAITER.CancelWait(wait_id)
+ return cancel
+
def WriteMessage(self,
buffer=None,
handles=None,
@@ -725,3 +738,4 @@ cdef class RunLoop(object):
cdef c_environment.CEnvironment* _ENVIRONMENT = new c_environment.CEnvironment()
+cdef c_environment.PythonAsyncWaiter* _ASYNC_WAITER = new c_environment.PythonAsyncWaiter()
« no previous file with comments | « mojo/public/python/mojo/c_environment.pxd ('k') | mojo/public/python/src/python_system_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698