PythonQt
Public Member Functions | List of all members
PythonQtThreadStateSaver Class Reference

#include <PythonQtThreadSupport.h>

Public Member Functions

 PythonQtThreadStateSaver ()
 
 ~PythonQtThreadStateSaver ()
 
void save ()
 
void restore ()
 

Detailed Description

This class wraps the Python save/restore thread state API. It can be used to allow other Python threads to run when entering C++ code from Python code.

Definition at line 104 of file PythonQtThreadSupport.h.

Constructor & Destructor Documentation

◆ PythonQtThreadStateSaver()

PythonQtThreadStateSaver::PythonQtThreadStateSaver ( )
inline

Definition at line 108 of file PythonQtThreadSupport.h.

References save().

◆ ~PythonQtThreadStateSaver()

PythonQtThreadStateSaver::~PythonQtThreadStateSaver ( )
inline

Definition at line 110 of file PythonQtThreadSupport.h.

References restore().

Member Function Documentation

◆ restore()

void PythonQtThreadStateSaver::restore ( )
inline

Definition at line 114 of file PythonQtThreadSupport.h.

115 {
116 if (_state) {
117 PyEval_RestoreThread(_state);
118 _state = nullptr;
119 }
120 }
PyObject * PythonQtConvertPairToPython(const void *inPair, int metaTypeId)

References PythonQtConvertPairToPython().

Referenced by ~PythonQtThreadStateSaver().

◆ save()

void PythonQtThreadStateSaver::save ( )
inline

Definition at line 112 of file PythonQtThreadSupport.h.

112{ _state = PyEval_SaveThread(); }

References PythonQtConvertPairToPython().

Referenced by PythonQtThreadStateSaver().


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