sessamekesh / igasync Goto Github PK
View Code? Open in Web Editor NEWC++ promise + task queue library for async programming across native and web targets
License: MIT License
C++ promise + task queue library for async programming across native and web targets
License: MIT License
A common use case in igecs
is to use a PromiseCombiner
for each node in an execution graph to gate running on all other dependencies, but strictly with void promises.
combine_chaining
seems to not like handling a void promise for some reason, and there's probably other goofy behavior here - add
had some bad behavior for a while, so it's very clear whatever dipshit was initially writing this didn't think about the void case at all.
(it was me, 2019-2020 me. I was the idiot)
Because tasks are only scheduled in order and not necessarily executed in order, it's very possible for a consuming callback to run before peeking callbacks are.
https://github.com/sessamekesh/igasync/blob/master/include/igasync/promise.inl#L38-L52
Minimal psuedo-code example:
auto promise = Promise<std::unique_ptr<int>>::Create();
auto fast_task_list = TaskList::Create();
auto slow_task_list = TaskList::Create();
// A peeking callback is created. Valid.
promise->on_resolve([](const auto& val) { /* ... */ }, slow_task_list);
// A consuming callback is added. Valid. No more peeking callbacks may be added.
promise->consume([](auto val) { /* ... */ }, fast_task_list);
// The promise is resolved, enqueuing all tasks.
promise->resolve(std::make_unique<int>(5));
// The fast task list "happens" to run first, for whatever reason. Valid.
// This invokes the consuming callback. Great.
fast_task_list->run();
// The slow task list "happens" to run later, eventually. Valid.
// This invokes the peeking callback on empty data. WRONG!
slow_task_list->run();
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.