Skip to content
sh1zenPublic

About

Blazingly fast concurrent Data Structures for Rust.

Topics

Resources

Stars

9 stars

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

crossync — Concurrent Data Structures for Rust

crossync is a Rust library for concurrent data structures and synchronization. The library has thread-safe collections, a multi-producer, multi-consumer (MPMC) channel, and reader-writer locks.

Install crossync

Run this command in your Cargo project.

cargo add crossync

Share a collection between threads

This example uses AtomicVec to add values from two threads. The cloned handle gives both threads access to the same collection.

use crossync::atomic::AtomicVec;
use std::thread;

let values = AtomicVec::new();
let worker_values = values.clone();

let worker = thread::spawn(move || worker_values.push(2));
values.push(1);
worker.join().unwrap();

assert_eq!(values.len(), 2);

Collections, channels, and synchronization

Type Use
AtomicVec Add and remove elements in a concurrent vector.
AtomicArray Read or change values by index in a fixed-capacity array.
AtomicHashMap Store key-value pairs in a concurrent hash map.
AtomicBuffer Transfer boxed values through a bounded ring buffer.
Atomic and AtomicCell Control access to one value.
Mpmc Send messages through a bounded or unbounded channel.
RwLock and SpinCell Give access to multiple readers or one writer.
Barrier Make threads wait at a phase boundary.

Documentation

License

crossync uses the Apache License 2.0.

About

Blazingly fast concurrent Data Structures for Rust.

Topics

Resources

Stars

9 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages