Skip to content

Asynchronous completion objects

include/thread/async_completion.h View source View on GitHub
struct async_completion {
    union {
        struct apc  apc;
        struct {
            apc_func_t                  apc_func_internal;
            void                        *ctx;
            enum async_completion_type  type;
            struct thread               *thread;
        };
    };
    void  (*callback)(struct async_completion *);
};
enum async_completion_type {
    ASYNC_COMPLETION_APC = 0,
    ASYNC_COMPLETION_WORKER = 1,
};
void async_complete(struct async_completion *ac, void *ctx);
void async_apc_callback_internal(void *arg);
void async_prepare(struct async_completion *ac, void (*cb)(
        struct async_completion *), enum async_completion_type type);
#define ASYNC_CTX_NONE NULL