class mrpt::imgui::AsyncTaskContext

Overview

Shared state between an AsyncTask and its worker function: the worker reports progress and checks for cancellation through it.

#include <mrpt/imgui/AsyncTask.h>

class AsyncTaskContext
{
public:
    // methods

    void setProgress(double fraction, const std::string& message = {});
    double progress() const;
    std::string message() const;
    bool cancelRequested() const;
    void requestCancel();
};

Methods

void setProgress(double fraction, const std::string& message = {})

Reports progress in [0,1], and optionally a short status message.

bool cancelRequested() const

Long workers should poll this and return early when true.