00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef PYTHONTHREAD_H
00016 #define PYTHONTHREAD_H
00017
00018 #include "pandabase.h"
00019
00020 #include "thread.h"
00021
00022 #ifdef HAVE_PYTHON
00023
00024
00025
00026
00027
00028
00029 class EXPCL_PANDA_PIPELINE PythonThread : public Thread {
00030 PUBLISHED:
00031 PythonThread(PyObject *function, PyObject *args,
00032 const string &name, const string &sync_name);
00033 virtual ~PythonThread();
00034
00035 BLOCKING PyObject *join();
00036
00037 protected:
00038 virtual void thread_main();
00039
00040 private:
00041 PyObject *_function;
00042 PyObject *_args;
00043 PyObject *_result;
00044
00045 public:
00046 static TypeHandle get_class_type() {
00047 return _type_handle;
00048 }
00049 static void init_type() {
00050 Thread::init_type();
00051 register_type(_type_handle, "PythonThread",
00052 Thread::get_class_type());
00053 }
00054 virtual TypeHandle get_type() const {
00055 return get_class_type();
00056 }
00057 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00058
00059 private:
00060 static TypeHandle _type_handle;
00061 };
00062 #endif // HAVE_PYTHON
00063
00064 #endif
00065