Skip to content

Commit

Permalink
Rename concurrent to conc.
Browse files Browse the repository at this point in the history
  • Loading branch information
ticki committed May 26, 2017
1 parent d8ff5dd commit aef4e42
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion atomic-hashmap/Cargo.toml
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
authors = ["ticki <ticki@users.noreply.github.com>"]

[dependencies]
concurrent = "0.1"
conc = "0.1"
6 changes: 3 additions & 3 deletions atomic-hashmap/src/lib.rs
Expand Up @@ -18,7 +18,7 @@
//! See [this blog post](https://ticki.github.io/blog/an-atomic-hash-table/)
//! for details.

extern crate concurrent;
extern crate conc;

mod sponge;
mod table;
Expand All @@ -36,15 +36,15 @@ pub struct HashMap<K, V> {

impl<K: Hash + Eq, V> HashMap<K, V> {
/// Insert a key with a certain value into the map.
pub fn insert(&self, key: K, val: V) -> Option<concurrent::Guard<V>> {
pub fn insert(&self, key: K, val: V) -> Option<conc::Guard<V>> {
self.table.insert(table::Pair {
key: key,
val: val,
}, Sponge::new(&key))
}

/// Remove a key from the hash map.
pub fn remove(&self, key: K) -> Option<concurrent::Guard<V>> {
pub fn remove(&self, key: K) -> Option<conc::Guard<V>> {
self.table.remove(key, Sponge::new(&key))
}

Expand Down
12 changes: 6 additions & 6 deletions atomic-hashmap/src/table.rs
Expand Up @@ -27,7 +27,7 @@ enum Node<K, V> {
#[derive(Default)]
pub struct Table<K, V> {
/// The buckets in the table.
buckets: [concurrent::Option<Node<K, V>>; 256],
buckets: [conc::Option<Node<K, V>>; 256],
}

impl<K: Hash + Eq, V> Table<K, V> {
Expand All @@ -51,11 +51,11 @@ impl<K: Hash + Eq, V> Table<K, V> {
if pos_a != pos_b {
// The two position did not collide, so we can insert the two pairs at the respective
// positions
table[pos_a as usize] = concurrent::Option::new(Some(Box::new(Node::Leaf(pair_a))));
table[pos_b as usize] = concurrent::Option::new(Some(Box::new(Node::Leaf(pair_b))));
table[pos_a as usize] = conc::Option::new(Some(Box::new(Node::Leaf(pair_a))));
table[pos_b as usize] = conc::Option::new(Some(Box::new(Node::Leaf(pair_b))));
} else {
// The two positions from the sponge matched, so we must place another branch.
table[pos_a as usize] = concurrent::Option::new(Some(Box::new(Node::Branch(
table[pos_a as usize] = conc::Option::new(Some(Box::new(Node::Branch(
Table::two_entries(pair_a, sponge_a, pair_b, sponge_b)
))));
}
Expand All @@ -64,7 +64,7 @@ impl<K: Hash + Eq, V> Table<K, V> {
}

/// Get the value associated with some key, given its sponge.
pub fn get(&self, key: &K, sponge: Sponge) -> Option<concurrent::Guard<V>> {
pub fn get(&self, key: &K, sponge: Sponge) -> Option<conc::Guard<V>> {
// Load the bucket and handle the respective cases.
self.buckets[sponge.squeeze() as usize].load(atomic::Ordering::Acquire)
.and_then(|node| node.map(|node| match node {
Expand Down Expand Up @@ -188,7 +188,7 @@ impl<K: Hash + Eq, V> Table<K, V> {
&self,
key: &K,
sponge: Sponge,
) -> Option<concurrent::Guard<K, V>> {
) -> Option<conc::Guard<K, V>> {
// We squeeze the sponge to get the right bucket of our table, in which we will potentially
// remove the key.
let bucket = self.buckets[sponge.squeeze() as usize];
Expand Down
4 changes: 2 additions & 2 deletions concurrent/Cargo.toml → conc/Cargo.toml
@@ -1,10 +1,10 @@
[package]
name = "concurrent"
name = "conc"
version = "0.1.2"
authors = ["ticki <Ticki@users.noreply.github.com>"]
description = "Hazard-pointer-based concurrent memory reclamation."
repository = "https://github.com/ticki/tfs"
documentation = "https://docs.rs/concurrent"
documentation = "https://docs.rs/conc"
license = "MIT"
keywords = ["crossbeam", "hazard", "concurrent", "epoch", "gc"]
exclude = ["target", "Cargo.lock"]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions concurrent/src/lib.rs → conc/src/lib.rs
@@ -1,6 +1,6 @@
//! # `concurrent` — An efficient concurrent reclamation system
//! # `conc` — An efficient concurrent reclamation system
//!
//! `concurrent` builds upon hazard pointers to create a extremely performant system for
//! `conc` builds upon hazard pointers to create a extremely performant system for
//! concurrently handling memory. It is more general and convenient — and often also faster — than
//! epoch-based reclamation.
//!
Expand All @@ -17,7 +17,7 @@
//!
//! ## Usage
//!
//! While the low-level API is available, it is generally sufficient to use the `concurrent::Option`
//! While the low-level API is available, it is generally sufficient to use the `conc::Option`
//! abstraction. This acts much like familiar Rust APIs. It allows the programmer to concurrently
//! access a value through references, as well as update it, and more. Refer to the respective docs
//! for more information.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion concurrent/src/sync/mod.rs → conc/src/sync/mod.rs
@@ -1,4 +1,4 @@
//! Various simple lock-free data structures built on `concurrent`
//! Various simple lock-free data structures built on `conc`

mod stm;
mod treiber;
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit aef4e42

Please sign in to comment.