std1.0.0-beta-7 SafeC docs

std :: async::executor

Struct std::AsyncTask

#include <std/async/executor.h> source

generic<F: Future, T> struct AsyncTask {
    struct TaskHeader hdr;
    F fut;
    T out[1];
}

A future and the room for its output: the unit an executor runs.

Fields

first: executors see &task.hdr

§T out[1]source

the output, once finished (not aborted)

Methods

§static struct AsyncTask<F, T> new(F fut)source · definition

A task for 'fut', not yet spawned. Move it to its final place before spawning it; it must not move after.

§int is_finished() constsource · definition

done, either way

§int is_aborted() constsource · definition
§?T take()source · definition

The output, if it finished (not aborted) and wasn't taken yet: it moves out of the task (once).

§void drop()source · definition

The task owns its future and, until taken, its output. Drop it once it finished (or was aborted) and nothing polls it any more.