Base::PyGILStateRelease Class Reference

If a thread holds the global interpreter lock (GIL) but runs a long operation in C where it doesn't need to hold the GIL it can release it temporarily. More...

#include <Interpreter.h>

Public Member Functions

 PyGILStateRelease ()
 
 ~PyGILStateRelease ()
 

Detailed Description

If a thread holds the global interpreter lock (GIL) but runs a long operation in C where it doesn't need to hold the GIL it can release it temporarily.

Or if the thread has to run code in the main thread where Python code may be executed it must release the GIL to avoid a deadlock. In either case the thread must hold the GIL when instantiating an object of PyGILStateRelease. As PyGILStateLocker it's best to create an instance of PyGILStateRelease on the stack.

Constructor & Destructor Documentation

◆ PyGILStateRelease()

Base::PyGILStateRelease::PyGILStateRelease ( )

◆ ~PyGILStateRelease()

Base::PyGILStateRelease::~PyGILStateRelease ( )

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