std1.0.0-beta-7 SafeC docs

std :: async::executor

Struct std::TaskHeader

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

struct TaskHeader {
    int state;
    ?&TaskHeader next;
    struct WakerSlot joiner;
    struct Spinlock lock;
}

The part of an AsyncTask an executor sees. First field of every AsyncTask, so a ?&TaskHeader and the task have the same address: poll_ and drop_ are AsyncTask<F, T>'s own functions, stored by AsyncTask::new as functions of the header (see std/erased.h).

Fields

§int statesource

ASYNC_TASK_* bits, changed atomically

the executor's list link

§struct WakerSlot joinersource

a JoinHandle waiting for it

§struct Spinlock locksource

guards 'joiner' and the DONE transition