From aef4e42fcf5b18c44bff5569ea8d8fc281bdda75 Mon Sep 17 00:00:00 2001 From: ticki Date: Sat, 27 May 2017 00:27:11 +0200 Subject: [PATCH] Rename `concurrent` to `conc`. --- atomic-hashmap/Cargo.toml | 2 +- atomic-hashmap/src/lib.rs | 6 +++--- atomic-hashmap/src/table.rs | 12 ++++++------ {concurrent => conc}/Cargo.toml | 4 ++-- {concurrent => conc}/src/garbage.rs | 0 {concurrent => conc}/src/global.rs | 0 {concurrent => conc}/src/guard.rs | 0 {concurrent => conc}/src/hazard.rs | 0 {concurrent => conc}/src/lib.rs | 6 +++--- {concurrent => conc}/src/local.rs | 0 {concurrent => conc}/src/mpsc.rs | 0 {concurrent => conc}/src/option.rs | 0 {concurrent => conc}/src/sync/mod.rs | 2 +- {concurrent => conc}/src/sync/stm.rs | 0 {concurrent => conc}/src/sync/treiber.rs | 0 15 files changed, 16 insertions(+), 16 deletions(-) rename {concurrent => conc}/Cargo.toml (85%) rename {concurrent => conc}/src/garbage.rs (100%) rename {concurrent => conc}/src/global.rs (100%) rename {concurrent => conc}/src/guard.rs (100%) rename {concurrent => conc}/src/hazard.rs (100%) rename {concurrent => conc}/src/lib.rs (96%) rename {concurrent => conc}/src/local.rs (100%) rename {concurrent => conc}/src/mpsc.rs (100%) rename {concurrent => conc}/src/option.rs (100%) rename {concurrent => conc}/src/sync/mod.rs (54%) rename {concurrent => conc}/src/sync/stm.rs (100%) rename {concurrent => conc}/src/sync/treiber.rs (100%) diff --git a/atomic-hashmap/Cargo.toml b/atomic-hashmap/Cargo.toml index eb92517..bce2cb8 100644 --- a/atomic-hashmap/Cargo.toml +++ b/atomic-hashmap/Cargo.toml @@ -4,4 +4,4 @@ version = "0.1.0" authors = ["ticki "] [dependencies] -concurrent = "0.1" +conc = "0.1" diff --git a/atomic-hashmap/src/lib.rs b/atomic-hashmap/src/lib.rs index f190798..14abd6b 100644 --- a/atomic-hashmap/src/lib.rs +++ b/atomic-hashmap/src/lib.rs @@ -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; @@ -36,7 +36,7 @@ pub struct HashMap { impl HashMap { /// Insert a key with a certain value into the map. - pub fn insert(&self, key: K, val: V) -> Option> { + pub fn insert(&self, key: K, val: V) -> Option> { self.table.insert(table::Pair { key: key, val: val, @@ -44,7 +44,7 @@ impl HashMap { } /// Remove a key from the hash map. - pub fn remove(&self, key: K) -> Option> { + pub fn remove(&self, key: K) -> Option> { self.table.remove(key, Sponge::new(&key)) } diff --git a/atomic-hashmap/src/table.rs b/atomic-hashmap/src/table.rs index f88cff6..86a2769 100644 --- a/atomic-hashmap/src/table.rs +++ b/atomic-hashmap/src/table.rs @@ -27,7 +27,7 @@ enum Node { #[derive(Default)] pub struct Table { /// The buckets in the table. - buckets: [concurrent::Option>; 256], + buckets: [conc::Option>; 256], } impl Table { @@ -51,11 +51,11 @@ impl Table { 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) )))); } @@ -64,7 +64,7 @@ impl Table { } /// Get the value associated with some key, given its sponge. - pub fn get(&self, key: &K, sponge: Sponge) -> Option> { + pub fn get(&self, key: &K, sponge: Sponge) -> Option> { // 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 { @@ -188,7 +188,7 @@ impl Table { &self, key: &K, sponge: Sponge, - ) -> Option> { + ) -> Option> { // 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]; diff --git a/concurrent/Cargo.toml b/conc/Cargo.toml similarity index 85% rename from concurrent/Cargo.toml rename to conc/Cargo.toml index 5e82a1a..bb8d396 100644 --- a/concurrent/Cargo.toml +++ b/conc/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "concurrent" +name = "conc" version = "0.1.2" authors = ["ticki "] 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"] diff --git a/concurrent/src/garbage.rs b/conc/src/garbage.rs similarity index 100% rename from concurrent/src/garbage.rs rename to conc/src/garbage.rs diff --git a/concurrent/src/global.rs b/conc/src/global.rs similarity index 100% rename from concurrent/src/global.rs rename to conc/src/global.rs diff --git a/concurrent/src/guard.rs b/conc/src/guard.rs similarity index 100% rename from concurrent/src/guard.rs rename to conc/src/guard.rs diff --git a/concurrent/src/hazard.rs b/conc/src/hazard.rs similarity index 100% rename from concurrent/src/hazard.rs rename to conc/src/hazard.rs diff --git a/concurrent/src/lib.rs b/conc/src/lib.rs similarity index 96% rename from concurrent/src/lib.rs rename to conc/src/lib.rs index 6d62370..daba896 100644 --- a/concurrent/src/lib.rs +++ b/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. //! @@ -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. diff --git a/concurrent/src/local.rs b/conc/src/local.rs similarity index 100% rename from concurrent/src/local.rs rename to conc/src/local.rs diff --git a/concurrent/src/mpsc.rs b/conc/src/mpsc.rs similarity index 100% rename from concurrent/src/mpsc.rs rename to conc/src/mpsc.rs diff --git a/concurrent/src/option.rs b/conc/src/option.rs similarity index 100% rename from concurrent/src/option.rs rename to conc/src/option.rs diff --git a/concurrent/src/sync/mod.rs b/conc/src/sync/mod.rs similarity index 54% rename from concurrent/src/sync/mod.rs rename to conc/src/sync/mod.rs index 0a5b5fa..96f7ebe 100644 --- a/concurrent/src/sync/mod.rs +++ b/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; diff --git a/concurrent/src/sync/stm.rs b/conc/src/sync/stm.rs similarity index 100% rename from concurrent/src/sync/stm.rs rename to conc/src/sync/stm.rs diff --git a/concurrent/src/sync/treiber.rs b/conc/src/sync/treiber.rs similarity index 100% rename from concurrent/src/sync/treiber.rs rename to conc/src/sync/treiber.rs