18 #include "pandabase.h"
20 #include "asyncTaskBase.h"
22 #include "conditionVar.h"
23 #include "pStatCollector.h"
27 #undef HAVE_LONG_LONG // NSPR and Python both define this.
28 #undef _POSIX_C_SOURCE
70 INLINE State get_state()
const;
71 INLINE
bool is_alive()
const;
76 INLINE
void set_delay(
double delay);
77 INLINE
void clear_delay();
78 INLINE
bool has_delay()
const;
79 INLINE
double get_delay()
const;
80 double get_wake_time()
const;
81 void recalc_wake_time();
83 INLINE
double get_start_time()
const;
84 double get_elapsed_time()
const;
85 INLINE
int get_start_frame()
const;
86 int get_elapsed_frames()
const;
88 void set_name(
const string &name);
90 string get_name_prefix()
const;
92 INLINE AtomicAdjust::Integer get_task_id()
const;
94 void set_task_chain(
const string &chain_name);
95 INLINE
const string &get_task_chain()
const;
97 void set_sort(
int sort);
98 INLINE
int get_sort()
const;
100 void set_priority(
int priority);
101 INLINE
int get_priority()
const;
103 INLINE
void set_done_event(
const string &done_event);
104 INLINE
const string &get_done_event()
const;
107 INLINE
void set_python_object(PyObject *python_object);
108 INLINE PyObject *get_python_object()
const;
109 #endif // HAVE_PYTHON
111 INLINE
double get_dt()
const;
112 INLINE
double get_max_dt()
const;
113 INLINE
double get_average_dt()
const;
115 virtual void output(ostream &out)
const;
119 DoneStatus unlock_and_do_task();
121 virtual bool is_runnable();
122 virtual DoneStatus do_task();
127 AtomicAdjust::Integer _task_id;
137 Thread *_servicing_thread;
149 static AtomicAdjust::Integer _next_task_id;
156 PyObject *_python_object;
157 #endif // HAVE_PYTHON
163 static void init_type() {
164 AsyncTaskBase::init_type();
165 register_type(_type_handle,
"AsyncTask",
166 AsyncTaskBase::get_class_type());
169 return get_class_type();
171 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
181 INLINE ostream &operator << (ostream &out,
const AsyncTask &task) {
186 #include "asyncTask.I"
The abstract base class for AsyncTask.
A class to manage a loose queue of isolated tasks, which can be performed either synchronously (in th...
void clear_name()
Resets the Namable's name to empty.
A lightweight class that represents a single element that may be timed and/or counted via stats...
A special kind of task that serves as a list of tasks internally.
The AsyncTaskChain is a subset of the AsyncTaskManager.
This class represents a concrete task performed by an AsyncManager.
void output(ostream &out) const
Outputs the Namable.
A thread; that is, a lightweight process.
TypeHandle is the identifier used to differentiate C++ class types.