Coder Social home page Coder Social logo

igasync's People

Contributors

sessamekesh avatar

Watchers

 avatar  avatar  avatar

igasync's Issues

PromiseCombiner has some goofy behavior around void promises

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)

CRITICAL concurrency bug - consume may not be executed last

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();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.