knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
knowrob::py::no_gil Struct Reference

#include <gil.h>

Public Member Functions

 no_gil ()
 
 ~no_gil ()
 
 no_gil ()
 
 ~no_gil ()
 

Detailed Description

RAII class to release the GIL. This is useful when executing long running C++ code that does not need the GIL, i.e. because it does not interact with the Python interpreter.

Definition at line 17 of file gil.h.

Constructor & Destructor Documentation

◆ no_gil() [1/2]

knowrob::py::no_gil::no_gil ( )
inline

Definition at line 19 of file gil.h.

19 { state_ = PyEval_SaveThread(); }

◆ ~no_gil() [1/2]

knowrob::py::no_gil::~no_gil ( )
inline

Definition at line 21 of file gil.h.

21 { PyEval_RestoreThread(state_); }

◆ no_gil() [2/2]

knowrob::py::no_gil::no_gil ( )
inline

Definition at line 19 of file gil.h.

19 { state_ = PyEval_SaveThread(); }

◆ ~no_gil() [2/2]

knowrob::py::no_gil::~no_gil ( )
inline

Definition at line 21 of file gil.h.

21 { PyEval_RestoreThread(state_); }

The documentation for this struct was generated from the following file: