[pypy-dev] fiber support
David Callahan
dcallahan at fb.com
Mon Oct 16 15:18:07 EDT 2017
folly:fibers (https://github.com/facebook/folly/tree/master/folly/fibers ) is a C++ package for lightweight, cooperatively scheduled threads. We have an application which extends this to CPython by adding the following save/restore code around task function invocation:
auto tstate = PyThreadState_Get();
CHECK_NOTNULL(tstate);
auto savedFrame = tstate->frame;
auto savedExcType = tstate->exc_type;
auto savedExcValue = tstate->exc_value;
auto savedExcTraceback = tstate->exc_traceback;
func();
tstate->frame = savedFrame;
tstate->exc_type = savedExcType;
tstate->exc_value = savedExcValue;
tstate->exc_traceback = savedExcTraceback;
(here func is a boost::python::object)
This does not work in PyPy 5.9 immediately because the thread state object does not expose these fields nor are there accessor methods.
Is there a way to get similar effect in PyPy?
Thanks
david
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20171016/b2db5f9b/attachment.html>
More information about the pypy-dev
mailing list