.. index:: pair: class; PythonInterpreterState .. _doxid-class_python_interpreter_state: class PythonInterpreterState ============================ .. toctree:: :hidden: Overview ~~~~~~~~ Initializes the python interpreter as well as python threading. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class PythonInterpreterState { public: // construction :ref:`PythonInterpreterState`( int argc, const char*const* argv, bool allowThreads = false ); :ref:`PythonInterpreterState`( int argc, const std::vector& argv, bool allowThreads = false ); :ref:`PythonInterpreterState`(bool allowThreads = false); // methods void :ref:`allowThreads`(); bool :ref:`threadsAllowed`() const; void :ref:`endAllowThreads`(); }; .. _details-class_python_interpreter_state: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Initializes the python interpreter as well as python threading. Construction ------------ .. index:: pair: function; PythonInterpreterState .. _doxid-class_python_interpreter_state_1a799af554f495ac4d81faa40e464d6be3: .. ref-code-block:: cpp :class: doxyrest-title-code-block PythonInterpreterState( int argc, const char*const* argv, bool allowThreads = false ) Constructor. Initializes Python with the given start parameters, enables threading, and releases GIL. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - argc - :ref:`main() ` 's argc * - argv - :ref:`main() ` 's argv .. index:: pair: function; PythonInterpreterState .. _doxid-class_python_interpreter_state_1a06aae17043ccf5217437890d2d20f89c: .. ref-code-block:: cpp :class: doxyrest-title-code-block PythonInterpreterState( int argc, const std::vector& argv, bool allowThreads = false ) Constructor. Initializes Python with the given start parameters, enables threading, and releases GIL. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - argc - :ref:`main() ` 's argc * - argv - :ref:`main() ` 's argv .. index:: pair: function; PythonInterpreterState .. _doxid-class_python_interpreter_state_1ae88d7497a8d4524a97a8ee3f46bcace3: .. ref-code-block:: cpp :class: doxyrest-title-code-block PythonInterpreterState(bool allowThreads = false) Constructor. Initializes Python with the no start parameters, enables threading, and releases GIL. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - argc - :ref:`main() ` 's argc * - argv - :ref:`main() ` 's argv Methods ------- .. index:: pair: function; allowThreads .. _doxid-class_python_interpreter_state_1a1fa41a1874254f4669dfe24542a9200c: .. ref-code-block:: cpp :class: doxyrest-title-code-block void allowThreads() Allow execution of other threads. If this is set, main thread may not execute python code. .. index:: pair: function; threadsAllowed .. _doxid-class_python_interpreter_state_1adab4aee0b85faf027771d494148dc2ae: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool threadsAllowed() const Are threads currently allowed? .. rubric:: Returns: Returns true if allowed, false otherwise .. index:: pair: function; endAllowThreads .. _doxid-class_python_interpreter_state_1a28d06b48040138537c6f20d812387ead: .. ref-code-block:: cpp :class: doxyrest-title-code-block void endAllowThreads() Halt other threads from executin. This is required if python code should be executed in the main thread.