Skip to content

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), however, non-void types can be also supported (but with extra overhead). When AFuture's task is complete, the AFuture is removed from AAsyncHolder.

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;
};