summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMica White <botahamec@outlook.com>2024-03-08 15:34:07 -0500
committerMica White <botahamec@outlook.com>2024-03-08 15:34:07 -0500
commite98635ad8f9015f3749a8d90099ebd37bfb8100c (patch)
tree31aed6268ffcdad0407fa48e52d79ca288a216b3 /examples
parent44347114329545f6b53a621e09a596c53884413a (diff)
Allow moves
Diffstat (limited to 'examples')
-rw-r--r--examples/basic.rs5
-rw-r--r--examples/double_mutex.rs7
-rw-r--r--examples/list.rs7
3 files changed, 8 insertions, 11 deletions
diff --git a/examples/basic.rs b/examples/basic.rs
index 87e7a60..4ff85f8 100644
--- a/examples/basic.rs
+++ b/examples/basic.rs
@@ -1,11 +1,10 @@
use std::thread;
-use happylock::mutex::{Mutex, SpinLock};
-use happylock::ThreadKey;
+use happylock::{Mutex, ThreadKey};
const N: usize = 10;
-static DATA: SpinLock<i32> = Mutex::new(0);
+static DATA: Mutex<i32> = Mutex::new(0);
fn main() {
for _ in 0..N {
diff --git a/examples/double_mutex.rs b/examples/double_mutex.rs
index 18460e4..1469f45 100644
--- a/examples/double_mutex.rs
+++ b/examples/double_mutex.rs
@@ -1,12 +1,11 @@
use std::thread;
-use happylock::mutex::{Mutex, SpinLock};
-use happylock::{LockGuard, ThreadKey};
+use happylock::{LockGuard, Mutex, ThreadKey};
const N: usize = 10;
-static DATA_1: SpinLock<i32> = Mutex::new(0);
-static DATA_2: SpinLock<String> = Mutex::new(String::new());
+static DATA_1: Mutex<i32> = Mutex::new(0);
+static DATA_2: Mutex<String> = Mutex::new(String::new());
fn main() {
for _ in 0..N {
diff --git a/examples/list.rs b/examples/list.rs
index 448f70a..f9b8db8 100644
--- a/examples/list.rs
+++ b/examples/list.rs
@@ -1,11 +1,10 @@
use std::thread;
-use happylock::mutex::{Mutex, SpinLock};
-use happylock::{LockGuard, ThreadKey};
+use happylock::{LockGuard, Mutex, ThreadKey};
const N: usize = 10;
-static DATA: [SpinLock<usize>; 6] = [
+static DATA: [Mutex<usize>; 6] = [
Mutex::new(0),
Mutex::new(1),
Mutex::new(2),
@@ -14,7 +13,7 @@ static DATA: [SpinLock<usize>; 6] = [
Mutex::new(5),
];
-static SEED: SpinLock<u32> = Mutex::new(42);
+static SEED: Mutex<u32> = Mutex::new(42);
fn random(key: &mut ThreadKey) -> usize {
let mut seed = SEED.lock(key);