diff options
author | Andreas Sandberg <andreas.sandberg@arm.com> | 2017-05-09 19:22:53 +0100 |
---|---|---|
committer | Andreas Sandberg <andreas.sandberg@arm.com> | 2017-05-22 17:15:09 +0000 |
commit | 6914a229a038206341ae1fea46393965a555ca9a (patch) | |
tree | 4a11cfaed46dabc827c5ee17cd976f42b5f53d49 /ext/pybind11/docs/advanced/misc.rst | |
parent | ca1d18d599dcc620bf526fb22042af95b1b60b68 (diff) | |
download | gem5-6914a229a038206341ae1fea46393965a555ca9a.tar.xz |
ext: Upgrade PyBind11 to version 2.1.1
Change-Id: I16870dec402d661295f9d013dc23e362b2b2c169
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Curtis Dunham <curtis.dunham@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/3225
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'ext/pybind11/docs/advanced/misc.rst')
-rw-r--r-- | ext/pybind11/docs/advanced/misc.rst | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ext/pybind11/docs/advanced/misc.rst b/ext/pybind11/docs/advanced/misc.rst index c13df7bf8..d98466512 100644 --- a/ext/pybind11/docs/advanced/misc.rst +++ b/ext/pybind11/docs/advanced/misc.rst @@ -19,6 +19,7 @@ another name and use it in the macro to avoid this problem. Global Interpreter Lock (GIL) ============================= +When calling a C++ function from Python, the GIL is always held. The classes :class:`gil_scoped_release` and :class:`gil_scoped_acquire` can be used to acquire and release the global interpreter lock in the body of a C++ function call. In this way, long-running C++ code can be parallelized using @@ -169,6 +170,20 @@ would be then able to access the data behind the same pointer. .. [#f6] https://docs.python.org/3/extending/extending.html#using-capsules +Module Destructors +================== + +pybind11 does not provide an explicit mechanism to invoke cleanup code at +module destruction time. In rare cases where such functionality is required, it +is possible to emulate it using Python capsules with a destruction callback. + +.. code-block:: cpp + + auto cleanup_callback = []() { + // perform cleanup here -- this function is called with the GIL held + }; + + m.add_object("_cleanup", py::capsule(cleanup_callback)); Generating documentation using Sphinx ===================================== |