Coder Social home page Coder Social logo

pulse's People

Contributors

aerialx avatar bors[bot] avatar courajs avatar csherratt avatar lame-nickname avatar serprex avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pulse's Issues

SelectMap

As suggested by @kvark, Something that maps a pulse to data.

Possible Api:

fn add(&mut self, pulse: Pulse, value: T);

/// As part of Iterator
fn next(&mut self) -> Option<(Pulse, T)>;

Pulse multiple waiters

In order to let a pulse be waited on my multiple waiters we need a few features added.

  • Cloning of pulse
  • Reference counting of the pulse
  • Chaining of Waiting objects

One possible way:

Reference Counting

I think the state AtomicUsize could me multi tasked. We can use it as a flag and a reference count. The highest nibble would be saved for the flags. When the trigger is dropped it sets the highest bit as triggered 0x8xxx_xxxx and for dropped 0x4xxx_xxxx. The reference count is the lowest 30 bits.

When a Pulse is dropped it just decrements the entire. It deletes the Pulse's memory if the lowest 30 bits were equal to 1 && the dropped flag 0x4xxx_xxxx is set. If the trigger sets the flags and finds the lowest bits were 0, it will drop the packet since there is no Pulse left.

Wait list

Each wait object just needs a next: Option<Next> to chain wait lits. Atom already has a LIFO function to help locklessly chain these items.

Pulse allocator

Since all Pulses are the same, this is a good target for a object pool.

Lockfree `Select`

Select was initially build around a Mutexed core just to make sure the logic worked correctly. There is a way to modify the internals of the Select to use a giant atomic bitset. Each bit maps to a Signal.

Confusing constructor

pub unsafe fn cast_from_usize(ptr: usize) -> Pulse {

I'm not sure how much sense this constructor makes, the usize had to be a pointer to a value in the heap, which has been allocated by Box.

Single CAS

I'm convinced that there is a way to trigger a pulse -> signal with only a single CAS.

Right now there is three opeartions

  • Atomic or to set a flag,
  • Atomic swap to read the pending waitlist
  • Atomic dec to mark the trigger as ready to free

The or and the dec cannot be merged because the waitlist needs to be read and is protected by the value of the dec.

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.