Allow python asyncio Future to wrap folly Fibers
Summary: This implements a new AsyncioLoopController for FiberManager, wrapping AsyncioExecutor. Thanks to recent simplication of LoopController, if I haven't missed anything, code is fairly simple, though not optimizer for thread-local. fiber_manager.pxd|pyx allow to link the life-time of AsyncioLoopController/FiberManager to the asyncio event loop. Code is similar to (and rely on) executor.pxd|pyd, which does the same for AsyncioExecutor. fibers.h|pxd provide a helper function for C++/python callers. Code is similar to futures.h|pyd, which does the same for folly Future. This is the main reason to keep a separate function/callback parameters. Not necessary for fibers, but a generic callback implementation can work for both fibers/future, which is convenient. There are a few lines that feel duplicated between future/fibers implementation, but it felt overkill to abstract further. Reviewed By: andriigrynenko Differential Revision: D7811432 fbshipit-source-id: af0a07d7554acbab1fac44b7a9a6a98340501ef4
Showing
folly/python/fibers.h
0 → 100644
folly/python/fibers.pxd
0 → 100644
Please register or sign in to comment