Skip to content

Bondi - lock-free single producer multi producer ring buffer

Notifications You must be signed in to change notification settings

blasrodri/bondi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bondi - lock-free single producer multi producer ring buffer

Bondi is yet another attempt of producing a lock-free, bounded, single-producer, multi-consumer data structure.

Note: this is an experimental project. Expect things to break, and change.

Usage

    // initialize a writer and two readers
    // send 100 `Message`s, and receive them from different threads
    struct Message(usize)

    fn main() {
        let bondi = Bondi::new(100);
        let writer = bondi.get_tx().unwrap();
        let reader = bondi.get_rx().unwrap();
        let reader2 = bondi.get_rx().unwrap();

        std::thread::spawn(move || {
            for i in 0..100 {
                writer.write(Message(i));
            }
        });

        std::thread::spawn(move || {
            let _ = reader.read();
        });

        std::thread::spawn(move || {
            let _ = reader2.read();
        }).join().unwrap();
    }

Inspiration sources

Disruptor

Bus

Turbine

About

Bondi - lock-free single producer multi producer ring buffer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages