64 EXTENSION(
static PyObject *__await__(PyObject *
self));
65 EXTENSION(
static PyObject *__iter__(PyObject *
self));
67 INLINE
bool done()
const;
68 INLINE
bool cancelled()
const;
69 EXTENSION(PyObject *result(PyObject *timeout = Py_None)
const);
71 virtual bool cancel();
73 INLINE
void set_done_event(
const std::string &done_event);
74 INLINE
const std::string &get_done_event()
const;
75 MAKE_PROPERTY(done_event, get_done_event, set_done_event);
77 EXTENSION(PyObject *add_done_callback(PyObject *
self, PyObject *fn));
79 EXTENSION(
static PyObject *gather(PyObject *args));
81 virtual void output(std::ostream &out)
const;
84 BLOCKING
void wait(
double timeout);
86 INLINE
void set_result(std::nullptr_t);
101 virtual bool is_task()
const {
return false;}
103 void notify_done(
bool clean_exit);
119 INLINE
bool try_lock_pending();
120 INLINE
void unlock(FutureState new_state = FS_pending);
121 INLINE
bool set_future_state(FutureState state);
126 AtomicAdjust::Integer _future_state;
128 std::string _done_event;
135 friend class PythonTask;
141 static void init_type() {
142 TypedReferenceCount::init_type();
144 TypedReferenceCount::get_class_type());
147 return get_class_type();
149 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
155 INLINE std::ostream &operator << (std::ostream &out,
const AsyncFuture &fut) {
168 virtual bool cancel()
override;
170 INLINE
size_t get_num_futures()
const;
176 AtomicAdjust::Integer _num_pending;
184 static void init_type() {
185 AsyncFuture::init_type();
187 AsyncFuture::get_class_type());
189 virtual TypeHandle get_type()
const override {
190 return get_class_type();
192 virtual TypeHandle force_init_type()
override {init_type();
return get_class_type();}
This class represents a thread-safe handle to a promised future result of an asynchronous operation...
An optional parameter associated with an event.
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(), along with zero to four record_derivation()s.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypedObject * get_result() const
Returns this future's result.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The AsyncTaskChain is a subset of the AsyncTaskManager.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A base class for things which need to inherit from both TypedWritable and from ReferenceCount.
Specific future that collects the results of several futures.
A base class for all things that want to be reference-counted.
This class represents a concrete task performed by an AsyncManager.
This class implements a condition variable; see ConditionVar for a brief introduction to this class...
TypeHandle is the identifier used to differentiate C++ class types.
virtual bool cancel()
Cancels the future.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.