29 class PythonTask final :
public AsyncTask {
31 PythonTask(PyObject *
function = Py_None,
const std::string &name = std::string());
32 virtual ~PythonTask();
33 ALLOC_DELETED_CHAIN(PythonTask);
35 void set_function(PyObject *
function);
36 INLINE PyObject *get_function();
38 void set_args(PyObject *args,
bool append_task);
41 void set_upon_death(PyObject *upon_death);
42 INLINE PyObject *get_upon_death();
44 void set_owner(PyObject *owner);
45 INLINE PyObject *get_owner()
const;
56 int __setattr__(PyObject *
self, PyObject *attr, PyObject *v);
57 int __delattr__(PyObject *
self, PyObject *attr);
58 PyObject *__getattr__(PyObject *attr)
const;
60 int __traverse__(visitproc visit,
void *arg);
66 MAKE_PROPERTY(time, get_elapsed_time);
73 MAKE_PROPERTY(wake_time, get_wake_time);
76 MAKE_PROPERTY(wakeTime, get_wake_time);
79 MAKE_PROPERTY2(delay_time, has_delay, get_delay, set_delay, clear_delay);
82 MAKE_PROPERTY2(delayTime, has_delay, get_delay, set_delay, clear_delay);
86 MAKE_PROPERTY(frame, get_elapsed_frames);
93 virtual bool is_runnable();
94 virtual DoneStatus do_task();
95 DoneStatus do_python_task();
100 void register_to_owner();
101 void unregister_from_owner();
102 void call_owner_method(
const char *method_name);
103 void call_function(PyObject *
function);
108 PyObject *_upon_death;
111 PyObject *_exception;
112 PyObject *_exc_value;
113 PyObject *_exc_traceback;
115 PyObject *_generator;
116 PyObject *_future_done;
120 bool _registered_to_owner;
121 mutable bool _retrieved_exception;
129 static void init_type() {
130 AsyncTask::init_type();
132 AsyncTask::get_class_type());
135 return get_class_type();
137 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
145 #endif // HAVE_PYTHON This class represents a thread-safe handle to a promised future result of an asynchronous operation,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A class to manage a loose queue of isolated tasks, which can be performed either synchronously (in th...
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypedObject * get_result() const
Returns this future's result.
void set_result(std::nullptr_t)
Sets this future's result.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The default class template does not define any methods.
This class represents a concrete task performed by an AsyncManager.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.