15 #include "pythonThread.h"
28 PythonThread(PyObject *
function, PyObject *args,
29 const string &name,
const string &sync_name) :
37 if (!PyCallable_Check(_function)) {
38 nassert_raise(
"Invalid function passed to PythonThread constructor");
41 if (args == Py_None) {
43 _args = PyTuple_New(0);
46 if (PySequence_Check(args)) {
47 _args = PySequence_Tuple(args);
50 nassert_raise(
"Invalid args passed to PythonThread constructor");
77 PyObject *PythonThread::
81 if (_result == NULL) {
83 return Py_BuildValue(
"");
97 _result = call_python_func(_function, _args);
100 #endif // HAVE_PYTHON
void join()
Blocks the calling process until the thread terminates.
A thread; that is, a lightweight process.
TypeHandle is the identifier used to differentiate C++ class types.