Coder Social home page Coder Social logo

rferraro / eventual Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 186 KB

A futures library with continuations, inspired by the upcoming C++ Extensions for Concurrency (ISO/IEC TS 19571:xxxx)

License: MIT License

C++ 89.61% CMake 4.82% C 0.08% PowerShell 3.06% Shell 2.43%

eventual's People

Contributors

lsr0 avatar rferraro avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

lsr0

eventual's Issues

Leak in future::then

Debugging a leak issue led to the discovery that callbacks passed to eventual::shared_future::then() were never cleaned up. Further investigation suggests some parts of the State chain are retained whole. Below is a demonstrative test case:

#include <eventual/eventual.h>
#include <cstdio>
#include <memory>

static int canary_count = 0;
struct canary
{
    canary()  { canary_count += 1; printf("+canary (%d)\n", canary_count); }
    ~canary() { canary_count -= 1; printf("-canary (%d)\n", canary_count); }

    char block[1*1024*1024*1024];
};

static void promise_scope()
{
    eventual::promise<void> promise;
    auto fut = promise.get_future();

    auto shared_canary = std::make_shared<canary>();
    fut.then([shared_canary] (auto&) {});

    promise.set_value();
}

int main()
{
    promise_scope();
    return 0;
}

The output of the above is
+canary (1)
and valgrind indicates:
in use at exit: 1,073,742,464 bytes in 6 blocks

One fix seems to be explicitly clearing the callback list after invocation, but I do not know whether I am just working around a deeper problem, so have not created a pull request. The change is visible in lsr0/eventual@fe01399 for reference.

CI Builds on Travis CI Not Completing

I am unable to merge a pull request (#1) from @lsr0, because Travis CI is failing with an unrelated error:

gtest/1.7.0@lasote/stable: WARN: Your conan's client version is deprecated for the current remote (v0.20.0). Upgrade conan client.
ERROR: All remotes failed
CMake Error at library/test/CMakeLists.txt:64 (message):
Conan.io failed to install this project's dependencies, error: 1

Compatibility of newer versions of libstdc++ with this library.

While working on making updates to the CI Docker Images for newer C++ compilers, it's been noted there may be additional compatibility issues against newer versions of libstdc++. Under Travis CI, the build is returning errors related to "error: calling a private constructor of class 'std::future_error'". See: TravisCI Job Log.

A fix for these issues should be resolvable in a similar fashion to PullRequest #1. The build errors were not noted at the PullRequest #1's merge-time because the CI infrastructure hadn't yet started testing with newer compilers and libstdc++ versions.

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.