ScopedGilRelease

class ScopedGilRelease

The ScopedGilRelease class is used to release the Global Interpreter Lock (GIL) in Python, and re-acquire it when the scope ends.

Public Functions

inline explicit ScopedGilRelease(std::string callback_name)

Releasing the GIL within the given scope for non-blocking non-python tasks.

If the GIL is not even acquired, it logs the action without releasing.

Parameters:

callback_name – The name of the GIL-dropping scope, used for debugging purposes.

inline ~ScopedGilRelease()

Destructor for the ScopedGilRelease, re-acquiring the Global Interpreter Lock (GIL)

The destructor ensures the proper acquiring of the GIL when the ScopedGilRelease object goes out of scope, if and only-if the GIL was released at first place.