cwfitzgerald / fiber-tasking-library

A library for enabling task-based multi-threading. It allows execution of task graphs with arbitrary dependencies.
Apache License 2.0
0 stars 1 forks source link

Futures #1

Open DethRaid opened 5 years ago

DethRaid commented 5 years ago

Please add futures and promises for easy returning of data from tasks.

Suggested interface:

template<typename ValType>
class future {
public:
    void on_success(std::function<void(ValType)>);
    void on_failure(std::function<void(ErrorType)>);
    bool is_ready();
    void wait_until_ready();
    ValType&& get_value();
};
DethRaid commented 5 years ago

Oh I'd probably be cool if the on_success or on_failure methods could return another future, so you'd have some way of chaining futures together