Giter Club home page Giter Club logo

slimsig's People

Contributors

saraedum avatar tarqd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

saraedum

slimsig's Issues

Forwarding might be too perfect

If the user passes an R-Value reference to a signal with multiple slots I imagine that only the first slot would have access to it.

Support slot return values

Not sure how useful this is. Might not be worth complicating the core but it shouldn't impact performance since void return types can be specialized for

Dropping `shared_ptr` from the implementation

shared_ptrs are used by connections to keep them valid even after they have been disconnected or the signal has been disposed. The pro's of this are it reduces the chance of a segfault or other nasty bugs without the user having to think about it.

Downsides are they are expensive, requiring an extra level of indirection and more heap allocations than necessary. You can of course avoid heap allocations by using a memory-pool or other custom allocator but it seems annoying to have to work around it like that.

Alternatives would be store the slot functions directly in the underlying vector with a unique id or "cookie" which can be returned and stored by the connection object instead of a shared_ptr. You would need to do a brute-force lookup to remove it or check it's status but really that won't cost much considering your average list of slots is going to fit in the processors cache quite nicely.

`connection#disconnect` does not match expected behavior

If you call connection#disconnect while the signal is emitting, it will modify the slot list and cause it not to be fired if it hasn't been already. This is contradicts the expections of users of node's EventEmitter or boost::signals2

Remove thread safety cruft

It just doesn't seem natural to try and handle multithreaded concurrency this level. It's very app-specific so should be left to higher level libraries. Will be removing the ThreadPolicy templates but will replace it with a SignalTraits template to allow for custom slot_id types (if you need more than unsigned long long provides, though you definitely shouldn't

Fix re-entrancy

We want this to behave similar to nodes EventEmitter .

      it("should be re-entrant", [&] { // see test.js
        unsigned count{0};
        signal.connect([&]{
          ++count;
          if (count == 1) {
            signal.connect_once([&]{
              ++count;
            });
            signal.emit();
          };
        });
        signal.emit();
        AssertThat(count, Equals(3u))
      });

Should leave the count with 3, just like the equivilent code would with node. I have a solution for this that I'm cleaning up.

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.