NRP Core  1.4.1
PythonInterpreterState Class Reference

Initializes the python interpreter as well as python threading. More...

#include <python_interpreter_state.h>

Public Member Functions

 PythonInterpreterState (int argc, const char *const *argv, bool allowThreads=false)
 Constructor. Initializes Python with the given start parameters, enables threading, and releases GIL. More...
 
 PythonInterpreterState (int argc, const std::vector< const char * > &argv, bool allowThreads=false)
 Constructor. Initializes Python with the given start parameters, enables threading, and releases GIL. More...
 
 PythonInterpreterState (bool allowThreads=false)
 Constructor. Initializes Python with the no start parameters, enables threading, and releases GIL. More...
 
void allowThreads ()
 Allow execution of other threads. If this is set, main thread may not execute python code. More...
 
bool threadsAllowed () const
 Are threads currently allowed? More...
 
void endAllowThreads ()
 Halt other threads from executin. This is required if python code should be executed in the main thread. More...
 
 ~PythonInterpreterState ()
 Destructor. Reestablishes thread state. More...
 

Detailed Description

Initializes the python interpreter as well as python threading.

Constructor & Destructor Documentation

◆ PythonInterpreterState() [1/3]

PythonInterpreterState::PythonInterpreterState ( int  argc,
const char *const *  argv,
bool  allowThreads = false 
)

Constructor. Initializes Python with the given start parameters, enables threading, and releases GIL.

Parameters
argcmain()'s argc
argvmain()'s argv

◆ PythonInterpreterState() [2/3]

PythonInterpreterState::PythonInterpreterState ( int  argc,
const std::vector< const char * > &  argv,
bool  allowThreads = false 
)

Constructor. Initializes Python with the given start parameters, enables threading, and releases GIL.

Parameters
argcmain()'s argc
argvmain()'s argv

◆ PythonInterpreterState() [3/3]

PythonInterpreterState::PythonInterpreterState ( bool  allowThreads = false)
explicit

Constructor. Initializes Python with the no start parameters, enables threading, and releases GIL.

Parameters
argcmain()'s argc
argvmain()'s argv

◆ ~PythonInterpreterState()

PythonInterpreterState::~PythonInterpreterState ( )

Destructor. Reestablishes thread state.

Member Function Documentation

◆ allowThreads()

void PythonInterpreterState::allowThreads ( )

Allow execution of other threads. If this is set, main thread may not execute python code.

◆ endAllowThreads()

void PythonInterpreterState::endAllowThreads ( )

Halt other threads from executin. This is required if python code should be executed in the main thread.

◆ threadsAllowed()

bool PythonInterpreterState::threadsAllowed ( ) const

Are threads currently allowed?

Returns
Returns true if allowed, false otherwise

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