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 107 of file PythonQtThreadSupport.h.

107  {
108  save();
109  }

References save().

◆ ~PythonQtThreadStateSaver()

PythonQtThreadStateSaver::~PythonQtThreadStateSaver ( )
inline

Definition at line 111 of file PythonQtThreadSupport.h.

111  {
112  restore();
113  }

References restore().

Member Function Documentation

◆ restore()

void PythonQtThreadStateSaver::restore ( )
inline

Definition at line 119 of file PythonQtThreadSupport.h.

119  {
120  if (_state) {
121  PyEval_RestoreThread(_state);
122  _state = NULL;
123  }
124  }

Referenced by ~PythonQtThreadStateSaver().

◆ save()

void PythonQtThreadStateSaver::save ( )
inline

Definition at line 115 of file PythonQtThreadSupport.h.

115  {
116  _state = PyEval_SaveThread();
117  }

Referenced by PythonQtThreadStateSaver().


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