34 AsyncTask(
const std::string &name = std::string());
61 INLINE State get_state()
const;
62 INLINE
bool is_alive()
const;
67 INLINE
void set_delay(
double delay);
68 INLINE
void clear_delay();
69 INLINE
bool has_delay()
const;
70 INLINE
double get_delay()
const;
71 double get_wake_time()
const;
72 void recalc_wake_time();
74 INLINE
double get_start_time()
const;
75 double get_elapsed_time()
const;
76 INLINE
int get_start_frame()
const;
77 int get_elapsed_frames()
const;
79 void set_name(
const std::string &name);
81 std::string get_name_prefix()
const;
83 INLINE AtomicAdjust::Integer get_task_id()
const;
85 void set_task_chain(
const std::string &chain_name);
86 INLINE
const std::string &get_task_chain()
const;
88 void set_sort(
int sort);
89 INLINE
int get_sort()
const;
91 void set_priority(
int priority);
92 INLINE
int get_priority()
const;
96 INLINE
double get_dt()
const;
97 INLINE
double get_max_dt()
const;
98 INLINE
double get_average_dt()
const;
100 virtual void output(std::ostream &out)
const;
103 MAKE_PROPERTY(state, get_state);
104 MAKE_PROPERTY(alive, is_alive);
105 MAKE_PROPERTY(manager, get_manager);
108 MAKE_PROPERTY(name, get_name, set_name);
112 MAKE_PROPERTY(
id, get_task_id);
114 MAKE_PROPERTY(task_chain, get_task_chain, set_task_chain);
115 MAKE_PROPERTY(sort, get_sort, set_sort);
116 MAKE_PROPERTY(priority, get_priority, set_priority);
117 MAKE_PROPERTY(done_event, get_done_event, set_done_event);
119 MAKE_PROPERTY(dt, get_dt);
120 MAKE_PROPERTY(max_dt, get_max_dt);
121 MAKE_PROPERTY(average_dt, get_average_dt);
125 DoneStatus unlock_and_do_task();
127 virtual bool cancel() final;
128 virtual
bool is_task() const final {
return true;}
130 virtual bool is_runnable();
131 virtual DoneStatus do_task();
136 AtomicAdjust::Integer _task_id;
137 std::string _chain_name;
143 unsigned int _implicit_sort;
146 Thread *_servicing_thread;
157 static AtomicAdjust::Integer _next_task_id;
162 friend class PythonTask;
168 static void init_type() {
169 AsyncFuture::init_type();
171 AsyncFuture::get_class_type());
174 return get_class_type();
176 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
187 INLINE std::ostream &operator << (std::ostream &out,
const AsyncTask &task) {
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class represents a thread-safe handle to a promised future result of an asynchronous operation,...
virtual bool cancel()
Cancels the future.
set_done_event
Sets the event name that will be triggered when the future finishes.
The AsyncTaskChain is a subset of the AsyncTaskManager.
A class to manage a loose queue of isolated tasks, which can be performed either synchronously (in th...
A special kind of task that serves as a list of tasks internally.
This class represents a concrete task performed by an AsyncManager.
A base class for all things which can have a name.
void clear_name()
Resets the Namable's name to empty.
void output(std::ostream &out) const
Outputs the Namable.
A lightweight class that represents a single element that may be timed and/or counted via stats.
A thread; that is, a lightweight process.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...