AAsyncHolder#
Holds a set of futures keeping them valid.
| Header: | #include <AUI/Thread/AAsyncHolder.h> |
| CMake: | aui_link(my_target PUBLIC aui::core) |
Detailed Description#
Experimental Feature
This API is experimental. Experimental APIs are likely to contain bugs, might be changed or removed in the future.
Unlike AFutureSet, AAsyncHolder is intended to hold void futures (AFuture
Guarantees that held futures will never be executed or be during execution after AAsyncHolder is destroyed.
Cancels all futures in destructor.
Examples#
examples/ui/views/src/ExampleWindow.h
Views Example — All-in-one views building example.
bool onDragEnter(const ADragNDrop::EnterEvent& event) override;
private:
ADeque<_<AWindow>> mWindows;
AAsyncHolder mAsync;
_<IAudioPlayer> mWavAudio;
_<IAudioPlayer> mOggAudio;
};
examples/ui/infinite_lazy_list/src/main.cpp
Infinite Lazy List — Usage of AUI_DECLARATIVE_FOR to make an infinite lazy list.
struct State {
AProperty<AVector<_<Item>>> items;
AProperty<bool> needMore = false;
AAsyncHolder asyncTasks;
};
_<AView> myLazyList(_<State> state) {
// note that we observe for transition to true here, not the current state of property
// see PropertyTest_Observing_changes for more info