#include <functional>
#include <mutex>
#include <thread>
#include <vector>
namespace qb
{
using task = std::function<void(void)>;
struct taskpool {
static taskpool& get();
// submit a task that is executed once on a separate thread
void submit_async(const task &t);
// submit a task that is executed at the end of the current frame, in the
// main thread.
void submit_frame(const task &t);
// execute all frame tasks (only should be called from the main thread)
void frame();
private:
std::vector<task> _frametasks;
std::mutex _locktasks;
};
}