slide-rs / pulse Goto Github PK
View Code? Open in Web Editor NEWA composable wait system.
License: Apache License 2.0
A composable wait system.
License: Apache License 2.0
Line 268 in 8cbe16c
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)>;
In order to let a pulse be waited on my multiple waiters we need a few features added.
One possible way:
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.
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.
Since all Pulses are the same, this is a good target for a object pool.
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.
Line 175 in 8cbe16c
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
.
I'm convinced that there is a way to trigger a pulse
-> signal
with only a single CAS.
Right now there is three opeartions
The or and the dec cannot be merged because the waitlist needs to be read and is protected by the value of the dec.
This line for example shouldn't use Relaxed
.
Line 214 in 8cbe16c
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.