commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
c866ba80e4c38b0119823ab93f822f8e9dae2ce7 | Amanieu d'Antras | 2021-08-25T00:18:24 | Fix memory orderings on rwlock upgrade.
Fixes #294 | diff --git a/src/raw_rwlock.rs b/src/raw_rwlock.rs
index 75a9812..19b61c8 100644
--- a/src/raw_rwlock.rs
+++ b/src/raw_rwlock.rs
@@ -362,7 +362,7 @@ unsafe impl lock_api::RawRwLockUpgrade for RawRwLock {
unsafe fn upgrade(&self) {
let state = self.state.fetch_sub(
(ONE_READER | UPGRADABLE_BIT... | 1 | 2 | 2 |
4fd88be6a6d038e30e07ad930539c416b7535014 | Thom Chiovoloni | 2021-08-08T14:42:36 | Detect and work around TSan's lack of support for fences | diff --git a/core/build.rs b/core/build.rs
new file mode 100644
index 0000000..d29c769
--- /dev/null
+++ b/core/build.rs
@@ -0,0 +1,10 @@
+// Automatically detect tsan in a way that's compatible with both stable (which
+// doesn't support sanitizers) and nightly (which does). Works because build
+// scripts gets `cfg` ... | 2 | 26 | 5 |
6e3c66ee6c103b7618764e83f9df53fbcff2e8d4 | Thom Chiovoloni | 2021-08-07T21:44:08 | Fix Ordering on WordLock (tsan detected) | diff --git a/core/src/word_lock.rs b/core/src/word_lock.rs
index 450e985..453030d 100644
--- a/core/src/word_lock.rs
+++ b/core/src/word_lock.rs
@@ -154,7 +154,7 @@ impl WordLock {
if let Err(x) = self.state.compare_exchange_weak(
state,
state.with_queue_head(t... | 1 | 4 | 4 |
e68737825408c5798982112a7caadecf06462a9c | not_a_seagull | 2021-07-30T18:06:34 | Fix the issue where it leaks memory for no reason | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index 621593d..e909cf3 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -13,6 +13,10 @@ use core::ops::{Deref, DerefMut};
#[cfg(feature = "arc_lock")]
use alloc::sync::Arc;
+#[cfg(feature = "arc_lock")]
+use core::mem::ManuallyDrop;
+#[cfg(... | 3 | 105 | 88 |
c95dd20ffcb9bce673e8473cf3cdcab89363f77a | not_a_seagull | 2021-07-30T16:36:38 | missed a spot | diff --git a/lock_api/src/remutex.rs b/lock_api/src/remutex.rs
index 74be4ce..4d7d682 100644
--- a/lock_api/src/remutex.rs
+++ b/lock_api/src/remutex.rs
@@ -789,6 +789,7 @@ pub struct ArcReentrantMutexGuard<R: RawMutex, G: GetThreadId, T: ?Sized> {
marker: PhantomData<GuardNoSend>,
}
+#[cfg(feature = "arc_lock"... | 1 | 5 | 1 |
a12a47f806c92c70b04a7b05b54b2fc2a79bdb33 | not_a_seagull | 2021-07-30T16:35:09 | remutex locks | diff --git a/lock_api/src/remutex.rs b/lock_api/src/remutex.rs
index b49ec6c..74be4ce 100644
--- a/lock_api/src/remutex.rs
+++ b/lock_api/src/remutex.rs
@@ -19,6 +19,9 @@ use core::{
sync::atomic::{AtomicUsize, Ordering},
};
+#[cfg(feature = "arc_lock")]
+use alloc::sync::Arc;
+
#[cfg(feature = "owning_ref")]
... | 1 | 172 | 0 |
850a2e59d5ed85a85ed425679746d97532a2e93b | not_a_seagull | 2021-07-29T22:51:47 | Add arc_lock feature | diff --git a/lock_api/Cargo.toml b/lock_api/Cargo.toml
index 55b5c35..a5aaa31 100644
--- a/lock_api/Cargo.toml
+++ b/lock_api/Cargo.toml
@@ -20,3 +20,4 @@ serde = { version = "1.0.114", default-features = false, optional = true }
[features]
nightly = []
+arc_lock = []
diff --git a/lock_api/src/lib.rs b/lock_api/src... | 3 | 188 | 1 |
aea13505c05087ee87c1fd6ea5dba4464228c918 | Amanieu d'Antras | 2021-05-01T00:45:54 | Remove const_fn feature | diff --git a/lock_api/src/lib.rs b/lock_api/src/lib.rs
index 8af2a4b..6d58135 100644
--- a/lock_api/src/lib.rs
+++ b/lock_api/src/lib.rs
@@ -88,7 +88,7 @@
#![no_std]
#![warn(missing_docs)]
#![warn(rust_2018_idioms)]
-#![cfg_attr(feature = "nightly", feature(const_fn, const_fn_trait_bound))]
+#![cfg_attr(feature = "n... | 1 | 1 | 1 |
6303b54fb848d3d06d6a69479936f2d2900b3246 | Ralf Jung | 2021-04-26T15:22:05 | add new const_fn_trait_bound feature gate | diff --git a/lock_api/src/lib.rs b/lock_api/src/lib.rs
index d9097a3..8af2a4b 100644
--- a/lock_api/src/lib.rs
+++ b/lock_api/src/lib.rs
@@ -88,7 +88,7 @@
#![no_std]
#![warn(missing_docs)]
#![warn(rust_2018_idioms)]
-#![cfg_attr(feature = "nightly", feature(const_fn))]
+#![cfg_attr(feature = "nightly", feature(const... | 1 | 1 | 1 |
391cf555e94c05450cea2e88b42c95c6631ab163 | Noah | 2021-02-18T03:00:45 | Add [Raw]ReentrantMutex::is_owned_by_current_thread | diff --git a/lock_api/src/remutex.rs b/lock_api/src/remutex.rs
index 09833b0..b49ec6c 100644
--- a/lock_api/src/remutex.rs
+++ b/lock_api/src/remutex.rs
@@ -135,6 +135,13 @@ impl<R: RawMutex, G: GetThreadId> RawReentrantMutex<R, G> {
pub fn is_locked(&self) -> bool {
self.mutex.is_locked()
}
+
+ /... | 1 | 13 | 0 |
9cef1b00fbd879eedd1425e9953ffd601184d829 | Fintan Halpenny | 2021-01-27T10:58:50 | Update smallvec to 1.6.1
There was a vulnerability found in smallvec as described in:
* https://github.com/servo/rust-smallvec/issues/252
* https://github.com/RustSec/advisory-db/pull/552
This patch update the package version to 1.6.1 which is deemed safe to
use.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail... | diff --git a/core/Cargo.toml b/core/Cargo.toml
index f1a0802..cfa9e3b 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -11,7 +11,7 @@ edition = "2018"
[dependencies]
cfg-if = "1.0.0"
-smallvec = "1.0"
+smallvec = "1.6.1"
petgraph = { version = "0.5.1", optional = true }
thread-id = { version = "3.3.0", optio... | 1 | 1 | 1 |
19feb0297f37fa7bef23c1845c07024467ee4f59 | Nikhil Benesch | 2021-01-25T14:26:50 | core: Upgrade redox_syscall to v0.2.4 | diff --git a/core/Cargo.toml b/core/Cargo.toml
index db7830e..f1a0802 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -21,7 +21,7 @@ instant = "0.1.4"
libc = "0.2.71"
[target.'cfg(target_os = "redox")'.dependencies]
-redox_syscall = "0.1.56"
+redox_syscall = "0.2.4"
[target.'cfg(windows)'.dependencies]
wi... | 1 | 1 | 1 |
36a77db305769cd4f4d6ff49eb03e870bde4cb88 | Laurence Tratt | 2020-12-21T18:45:40 | Simplify debug_asserts. | diff --git a/core/src/thread_parker/unix.rs b/core/src/thread_parker/unix.rs
index a58e6ff..c2381e6 100644
--- a/core/src/thread_parker/unix.rs
+++ b/core/src/thread_parker/unix.rs
@@ -156,17 +156,9 @@ impl Drop for ThreadParker {
// this behaviour no longer occurs. The same applies to condvars.
unsaf... | 1 | 2 | 10 |
b6d4fdb510d34f096b6c0016043a28dddf623916 | Laurence Tratt | 2020-12-21T18:41:25 | Revert "OpenBSD returns EINVAL in the same way as DragonFlyBSD."
This reverts commit ca211ce279b4dfab3dd457154f7f47bce1b5995c. | diff --git a/core/src/thread_parker/unix.rs b/core/src/thread_parker/unix.rs
index 537b9e7..a58e6ff 100644
--- a/core/src/thread_parker/unix.rs
+++ b/core/src/thread_parker/unix.rs
@@ -156,13 +156,13 @@ impl Drop for ThreadParker {
// this behaviour no longer occurs. The same applies to condvars.
unsa... | 1 | 2 | 2 |
ca211ce279b4dfab3dd457154f7f47bce1b5995c | Laurence Tratt | 2020-12-19T08:50:27 | OpenBSD returns EINVAL in the same way as DragonFlyBSD. | diff --git a/core/src/thread_parker/unix.rs b/core/src/thread_parker/unix.rs
index a58e6ff..537b9e7 100644
--- a/core/src/thread_parker/unix.rs
+++ b/core/src/thread_parker/unix.rs
@@ -156,13 +156,13 @@ impl Drop for ThreadParker {
// this behaviour no longer occurs. The same applies to condvars.
unsa... | 1 | 2 | 2 |
c82fe5f8d4973c1cf284fa9ac8f1203c0e850cd9 | Emilio Cobos Álvarez | 2020-12-04T18:02:19 | core: Use a weaker dependency on smallvec.
Smallvec 1.4 regresses performance in Firefox, so while we fix it it'd
be nice to be able to not use the new version. parking_lot is not using
try_reserve so it can live with 1.0. | diff --git a/core/Cargo.toml b/core/Cargo.toml
index 1b5e9c8..09778be 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -11,7 +11,7 @@ edition = "2018"
[dependencies]
cfg-if = "1.0.0"
-smallvec = "1.4.0"
+smallvec = "1.0"
petgraph = { version = "0.5.1", optional = true }
thread-id = { version = "3.3.0", optio... | 1 | 1 | 1 |
45543767e6f33525b3af43b80a5bf8da4a66492e | Dominic Elm | 2020-12-04T17:01:46 | Remove instant dummy and update to latest wasm32 simd intrinsics | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index 1bd19eb..519ce9e 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -7,7 +7,6 @@
use crate::thread_parker::{ThreadParker, ThreadParkerT, UnparkHandleT};
use crate::util::UncheckedOptionExt;
use crate::word_lock::WordLock;
-use cf... | 2 | 37 | 50 |
27cb0326edfd566345e904958f91d7925b9486f4 | messense | 2020-11-24T02:50:36 | Drop support for cloudabi
rustc has already dropped support for all cloudabi targets: https://github.com/rust-lang/rust/pull/78439 | diff --git a/core/Cargo.toml b/core/Cargo.toml
index 29ead2f..1b5e9c8 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -23,9 +23,6 @@ libc = "0.2.71"
[target.'cfg(target_os = "redox")'.dependencies]
redox_syscall = "0.1.56"
-[target.'cfg(target_os = "cloudabi")'.dependencies]
-cloudabi = "0.1.0"
-
[target.'cf... | 4 | 0 | 315 |
4c00d6212aa5fa56d16cc8a1774ad908d10522bd | Amanieu d'Antras | 2020-11-17T22:57:51 | Fix bounds on Send and Sync impls for lock guards
Fixes #258
Fixes #259 | diff --git a/lock_api/src/lib.rs b/lock_api/src/lib.rs
index de72442..d9097a3 100644
--- a/lock_api/src/lib.rs
+++ b/lock_api/src/lib.rs
@@ -99,6 +99,8 @@ pub struct GuardSend(());
/// Marker type which indicates that the Guard type for a lock is not `Send`.
pub struct GuardNoSend(*mut ());
+unsafe impl Sync for Gu... | 3 | 5 | 7 |
ded782f1bdc4319ad2f294688eaf90f3061a1720 | Amanieu d'Antras | 2020-11-08T21:44:43 | RawRwLock::wait_for_readers needs an Acquire to synchronize with unlock_shared
Fixes #257 | diff --git a/src/raw_rwlock.rs b/src/raw_rwlock.rs
index 1feb0bd..75a9812 100644
--- a/src/raw_rwlock.rs
+++ b/src/raw_rwlock.rs
@@ -970,11 +970,11 @@ impl RawRwLock {
// At this point WRITER_BIT is already set, we just need to wait for the
// remaining readers to exit the lock.
let mut spinw... | 1 | 3 | 3 |
143710f2fe56576100f696642c086093a0b88513 | unknown | 2020-10-24T21:06:20 | Add winapi srwlock to benchmarks | diff --git a/benchmark/Cargo.toml b/benchmark/Cargo.toml
index 63b0893..9cd06cb 100644
--- a/benchmark/Cargo.toml
+++ b/benchmark/Cargo.toml
@@ -20,3 +20,6 @@ path = "src/rwlock.rs"
[features]
nightly = ["parking_lot/nightly"]
deadlock_detection = ["parking_lot/deadlock_detection"]
+
+[target.'cfg(windows)'.dependen... | 3 | 115 | 10 |
bb0bfb384bb86c27c6db59ea6987e3410be108a4 | Matt Brubeck | 2020-10-12T18:08:34 | Update to cfg-if 1.0 | diff --git a/core/Cargo.toml b/core/Cargo.toml
index 44903ca..29ead2f 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -10,7 +10,7 @@ categories = ["concurrency"]
edition = "2018"
[dependencies]
-cfg-if = "0.1.10"
+cfg-if = "1.0.0"
smallvec = "1.4.0"
petgraph = { version = "0.5.1", optional = true }
thread-... | 1 | 1 | 1 |
420bc3e82f94a582a49314962c0776c4bd3df6a1 | Mara Bos | 2020-10-03T11:46:47 | Explicitly yield in test_condvar_requeue, to make it work on Miri. | diff --git a/src/condvar.rs b/src/condvar.rs
index 5451168..534b8af 100644
--- a/src/condvar.rs
+++ b/src/condvar.rs
@@ -663,6 +663,9 @@ mod tests {
while !c.notify_one() {
// Wait for the thread to get into wait()
MutexGuard::bump(&mut g);
+ // Yield, so the other thread g... | 1 | 3 | 0 |
a2ffb96ee28a5698d48613ff4acb920420fa653a | Mara Bos | 2020-10-03T11:46:16 | Don't leak a forever-blocked thread in test_rwlock_recursive. | diff --git a/src/rwlock.rs b/src/rwlock.rs
index 89987c6..70e1b1a 100644
--- a/src/rwlock.rs
+++ b/src/rwlock.rs
@@ -539,8 +539,8 @@ mod tests {
fn test_rwlock_recursive() {
let arc = Arc::new(RwLock::new(1));
let arc2 = arc.clone();
- let _lock1 = arc.read();
- thread::spawn(move |... | 1 | 8 | 3 |
0919affd8fdb6c2ae204500fa3ca4ff6569174c5 | Nika Layzell | 2020-07-05T23:26:12 | update doc comment for review changes | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index 3fac3d0..e435d8a 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -279,9 +279,9 @@ impl<R: RawMutex, T: ?Sized> Mutex<R, T> {
///
/// # Safety
///
- /// The returned pointer must only be dereferenced if the current threa... | 3 | 11 | 9 |
b73d252dfaa5e4ac1fbbcb79e070ccbf21c5074b | Nika Layzell | 2020-07-04T20:13:48 | lock_api: Allow unsafely accessing data without a guard | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index 0f42578..3fac3d0 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -270,6 +270,22 @@ impl<R: RawMutex, T: ?Sized> Mutex<R, T> {
pub unsafe fn raw(&self) -> &R {
&self.raw
}
+
+ /// Returns a raw pointer to the underly... | 3 | 48 | 0 |
5b8add73454b77cd808155a61d60ea2d8b870b5f | Amanieu d'Antras | 2020-06-23T18:30:20 | Upgrade dependencies | diff --git a/Cargo.toml b/Cargo.toml
index e78bf26..8cd337e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,13 +13,13 @@ edition = "2018"
[dependencies]
parking_lot_core = { path = "core", version = "0.7.1" }
lock_api = { path = "lock_api", version = "0.3.4" }
-instant = "0.1"
+instant = "0.1.4"
[dev-dependencies... | 3 | 16 | 16 |
9ad8ae0c4cb34d1a99dafdd842256ad8af80e43d | Amanieu d'Antras | 2020-06-23T18:21:35 | Clarify wording around throughput vs fairness
Fixes #202 | diff --git a/src/mutex.rs b/src/mutex.rs
index 36e5ea7..9f63cb9 100644
--- a/src/mutex.rs
+++ b/src/mutex.rs
@@ -21,18 +21,18 @@ use lock_api;
///
/// A typical unfair lock can often end up in a situation where a single thread
/// quickly acquires and releases the same mutex in succession, which can starve
-/// othe... | 2 | 8 | 8 |
1347de084ddb6ee6a671beb97a8598588223e7be | Thomas Bächler | 2020-06-17T20:57:15 | Fix incorrect doc comments. | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index 782c067..0f42578 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -94,6 +94,11 @@ pub unsafe trait RawMutexFair: RawMutex {
/// by `lock`, however it can be much more efficient in the case where there
/// are no waiting threads.... | 2 | 7 | 0 |
b27fc5182240a7fa0de33b8c41aa5d4e295d9009 | Thomas Bächler | 2020-06-10T21:38:28 | Fix doc tests. | diff --git a/lock_api/src/lib.rs b/lock_api/src/lib.rs
index 6576546..de72442 100644
--- a/lock_api/src/lib.rs
+++ b/lock_api/src/lib.rs
@@ -52,7 +52,7 @@
//! .is_ok()
//! }
//!
-//! fn unlock(&self) {
+//! unsafe fn unlock(&self) {
//! self.0.store(false, Ordering::Release);
//! ... | 1 | 1 | 1 |
1445550839b8e2a2d91b712def6c45929c01d04e | Thomas Bächler | 2020-06-10T21:04:48 | lock_api: Make all methods of the RawRwLock* traits that assume a lock is being held unsafe. | diff --git a/lock_api/src/rwlock.rs b/lock_api/src/rwlock.rs
index 668688c..480245d 100644
--- a/lock_api/src/rwlock.rs
+++ b/lock_api/src/rwlock.rs
@@ -46,7 +46,11 @@ pub unsafe trait RawRwLock {
fn try_lock_shared(&self) -> bool;
/// Releases a shared lock.
- fn unlock_shared(&self);
+ ///
+ /// ... | 2 | 199 | 60 |
4015183b6842f1c82aaffa46a550941cd80606ff | Thomas Bächler | 2020-06-10T20:33:38 | lock_api: Make RawMutexFair::unlock_fair() and RawMutexFair::bump() unsafe. | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index 7100f0e..782c067 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -79,14 +79,23 @@ pub unsafe trait RawMutex {
/// unlocking, but may be necessary in certain circumstances.
pub unsafe trait RawMutexFair: RawMutex {
/// Unlocks this... | 4 | 56 | 17 |
14e28ca4e5a706c213567d81fb950413e16677f6 | Thomas Bächler | 2020-06-10T20:15:24 | lock_api: Make RawMutex::unlock() unsafe.
Unlocking a Mutex that you do not hold is likely to cause undefined behavior. If unlock()
is a safe method, then it likely impossible to provide a sound and efficient implemention
of the method. Since this API is usually only called by the lock_api Mutex structs, this
change s... | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index 9952c93..7100f0e 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -45,14 +45,27 @@ pub unsafe trait RawMutex {
fn try_lock(&self) -> bool;
/// Unlocks this mutex.
- fn unlock(&self);
+ ///
+ /// # Safety
+ ///
+ ... | 4 | 47 | 12 |
55f58b5cb8daf705c012799205d5d258d438ca7c | Amanieu d'Antras | 2020-06-11T09:52:24 | Remove deprecated and unsound MappedRwLockWriteGuard::downgrade | diff --git a/lock_api/src/rwlock.rs b/lock_api/src/rwlock.rs
index 4cdfd6b..668688c 100644
--- a/lock_api/src/rwlock.rs
+++ b/lock_api/src/rwlock.rs
@@ -1559,30 +1559,6 @@ impl<'a, R: RawRwLock + 'a, T: ?Sized + 'a> MappedRwLockWriteGuard<'a, R, T> {
}
}
-impl<'a, R: RawRwLockDowngrade + 'a, T: ?Sized + 'a> Map... | 1 | 0 | 24 |
d620881a224cd4b293380c853309cb5d6764372e | Marc Mettke | 2020-06-06T13:49:19 | Updating cloudabi to 0.1
`cloudabi::subscription`.`type_` got renamed to
`cloudabi::subscription`.`type` | diff --git a/core/Cargo.toml b/core/Cargo.toml
index 1a28500..76de2a4 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -24,7 +24,7 @@ libc = "0.2.55"
redox_syscall = "0.1"
[target.'cfg(target_os = "cloudabi")'.dependencies]
-cloudabi = "0.0.3"
+cloudabi = "0.1"
[target.'cfg(windows)'.dependencies]
winapi =... | 2 | 6 | 6 |
c531548daba39b89df9b1ef1306e83b929ed6b3e | Amanieu d'Antras | 2020-05-29T00:04:53 | Add missing #[inline] | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index 28b9f92..9952c93 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -48,6 +48,7 @@ pub unsafe trait RawMutex {
fn unlock(&self);
/// Checks whether the mutex is currently locked.
+ #[inline]
fn is_locked(&self) -> bool {... | 2 | 2 | 0 |
faea2a62c4db11495166525f53a8e665221cc1c4 | Amanieu d'Antras | 2020-05-27T22:59:23 | Add missing doc comment | diff --git a/lock_api/src/remutex.rs b/lock_api/src/remutex.rs
index cc1b5d0..ce08114 100644
--- a/lock_api/src/remutex.rs
+++ b/lock_api/src/remutex.rs
@@ -126,6 +126,7 @@ impl<R: RawMutex, G: GetThreadId> RawReentrantMutex<R, G> {
}
}
+ /// Checks whether the mutex is currently locked.
#[inlin... | 1 | 1 | 0 |
de9934a723b1338a32248cd7edf5f28f70045b38 | Noah | 2020-05-23T23:31:16 | Make RawReentrantMutex::is_locked pub | diff --git a/lock_api/src/remutex.rs b/lock_api/src/remutex.rs
index 6aab343..cc1b5d0 100644
--- a/lock_api/src/remutex.rs
+++ b/lock_api/src/remutex.rs
@@ -127,7 +127,7 @@ impl<R: RawMutex, G: GetThreadId> RawReentrantMutex<R, G> {
}
#[inline]
- fn is_locked(&self) -> bool {
+ pub fn is_locked(&self)... | 1 | 1 | 1 |
70e826a640b9a9e5756cfc90bd655d8ea4cebb49 | Noah | 2020-05-17T18:15:02 | Make RawReentrantMutex public | diff --git a/lock_api/src/remutex.rs b/lock_api/src/remutex.rs
index bdfcc40..9c7fdb9 100644
--- a/lock_api/src/remutex.rs
+++ b/lock_api/src/remutex.rs
@@ -47,14 +47,36 @@ pub unsafe trait GetThreadId {
fn nonzero_thread_id(&self) -> NonZeroUsize;
}
-struct RawReentrantMutex<R, G> {
+/// A raw mutex type that ... | 1 | 45 | 8 |
860f94ffbe726a701076cdcb62fda55ed210afb5 | Noah | 2020-05-18T21:51:35 | Provide an implementation for parking_lot::RawRwLock::is_locked | diff --git a/src/raw_rwlock.rs b/src/raw_rwlock.rs
index 2a8e84b..e8c0224 100644
--- a/src/raw_rwlock.rs
+++ b/src/raw_rwlock.rs
@@ -138,6 +138,12 @@ unsafe impl lock_api::RawRwLock for RawRwLock {
self.unlock_shared_slow();
}
}
+
+ #[inline]
+ fn is_locked(&self) -> bool {
+ let... | 1 | 6 | 0 |
eee0dd10ef7117caec142b9d0b448ab981aa684a | Noah | 2020-05-18T19:29:50 | Simplify RawReentrantMutex::is_locked() | diff --git a/lock_api/src/remutex.rs b/lock_api/src/remutex.rs
index efe2a2f..7d7cb91 100644
--- a/lock_api/src/remutex.rs
+++ b/lock_api/src/remutex.rs
@@ -101,8 +101,7 @@ impl<R: RawMutex, G: GetThreadId> RawReentrantMutex<R, G> {
#[inline]
fn is_locked(&self) -> bool {
- let id = self.get_thread_i... | 1 | 1 | 2 |
9bf34bbae56736c92ef8ace633063d1d0e603c71 | Noah | 2020-05-18T19:29:11 | Remove the RawRwLock::is_locked_{shared,exclusive} differentiation | diff --git a/lock_api/src/rwlock.rs b/lock_api/src/rwlock.rs
index fc6596c..09231c1 100644
--- a/lock_api/src/rwlock.rs
+++ b/lock_api/src/rwlock.rs
@@ -59,20 +59,6 @@ pub unsafe trait RawRwLock {
/// Checks if this `RwLock` is currently locked in any way.
fn is_locked(&self) -> bool {
- self.is_lock... | 1 | 0 | 26 |
0f33276132c7342ef31b01333995a3d063e5033e | Noah | 2020-05-18T18:42:13 | Add [Raw]RwLock::is_locked() | diff --git a/lock_api/src/rwlock.rs b/lock_api/src/rwlock.rs
index 892ba52..fc6596c 100644
--- a/lock_api/src/rwlock.rs
+++ b/lock_api/src/rwlock.rs
@@ -56,6 +56,29 @@ pub unsafe trait RawRwLock {
/// Releases an exclusive lock.
fn unlock_exclusive(&self);
+
+ /// Checks if this `RwLock` is currently loc... | 1 | 41 | 0 |
de2f68f33499b253ef525a80837e4e7bbf8f648a | Noah | 2020-05-18T18:41:45 | Add ReentrantMutex::is_locked() | diff --git a/lock_api/src/remutex.rs b/lock_api/src/remutex.rs
index bdfcc40..efe2a2f 100644
--- a/lock_api/src/remutex.rs
+++ b/lock_api/src/remutex.rs
@@ -98,6 +98,12 @@ impl<R: RawMutex, G: GetThreadId> RawReentrantMutex<R, G> {
self.mutex.unlock();
}
}
+
+ #[inline]
+ fn is_locked(&... | 1 | 12 | 0 |
607adf59dc37af1ac1f56bb94002779dc0546118 | Noah | 2020-05-18T18:40:51 | Add Mutex::is_locked() | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index 85fb6f0..28b9f92 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -207,6 +207,12 @@ impl<R: RawMutex, T: ?Sized> Mutex<R, T> {
unsafe { &mut *self.data.get() }
}
+ /// Checks whether the mutex is currently locked.
+ ... | 1 | 6 | 0 |
0acf79e88bf01e6e0b98731e3f2b09d662d7c802 | Noah | 2020-05-18T16:32:24 | Add RawMutex::is_locked() | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index 352ac31..85fb6f0 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -46,6 +46,15 @@ pub unsafe trait RawMutex {
/// Unlocks this mutex.
fn unlock(&self);
+
+ /// Checks whether the mutex is currently locked.
+ fn is_locked... | 3 | 20 | 0 |
37ceeb36a1b0ef9cc0176ef0c9e35b8562002656 | Azriel Hoh | 2020-05-15T05:15:54 | Uses `instant::Instant` in place of `std::time::Instant`. | diff --git a/Cargo.toml b/Cargo.toml
index ebe62d5..9e60c9a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,6 +13,7 @@ edition = "2018"
[dependencies]
parking_lot_core = { path = "core", version = "0.7.1" }
lock_api = { path = "lock_api", version = "0.3.4" }
+instant = "0.1"
[dev-dependencies]
rand = "0.7"
@@ -2... | 19 | 37 | 26 |
06b203706d87779d2cb60c03df90998cc94ca4a1 | Dominic Elm | 2020-04-21T13:18:00 | Replace Instant with dummy on wasm32-unknown-unknown | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index fb87aef..440b7c7 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -4,7 +4,7 @@
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may n... | 1 | 46 | 6 |
8030870c0f706abd17c88e85865dd77ebf683587 | Palana | 2020-04-10T20:13:52 | Update required parking_lot_core version | diff --git a/Cargo.toml b/Cargo.toml
index 30d3fd4..5bdb459 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,7 +11,7 @@ categories = ["concurrency"]
edition = "2018"
[dependencies]
-parking_lot_core = { path = "core", version = "0.7.0" }
+parking_lot_core = { path = "core", version = "0.7.1" }
lock_api = { path = "... | 1 | 1 | 1 |
413432c43e6830c6ff9da1d88ae51c7e68f0ee0b | Palana | 2020-04-10T19:26:08 | Fix required lock_api version
As of https://github.com/Amanieu/parking_lot/commit/c20495bcc5b3e26cd835ec52aea917b44724d7c3
the additions to lock_api in https://github.com/Amanieu/parking_lot/commit/a9961d4ec400ef54a49183f9063ddf40f2ca23e7
are required to build parking_lot; building with lock_api 0.3.{1,2,3}
fails due ... | diff --git a/Cargo.toml b/Cargo.toml
index f250c95..30d3fd4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,7 @@ edition = "2018"
[dependencies]
parking_lot_core = { path = "core", version = "0.7.0" }
-lock_api = { path = "lock_api", version = "0.3.1" }
+lock_api = { path = "lock_api", version = "0.3.4" }
... | 1 | 1 | 1 |
699325c9a7119694f009372c7a4f83c8fa8384a6 | Amanieu d'Antras | 2020-04-10T16:20:10 | Add test for #203 | diff --git a/tests/issue_203.rs b/tests/issue_203.rs
new file mode 100644
index 0000000..a77a95f
--- /dev/null
+++ b/tests/issue_203.rs
@@ -0,0 +1,26 @@
+use parking_lot::RwLock;
+use std::thread;
+
+struct Bar(RwLock<()>);
+
+impl Drop for Bar {
+ fn drop(&mut self) {
+ let _n = self.0.write();
+ }
+}
+
+... | 1 | 26 | 0 |
9bed8e3dd15c2da0939027d5445bb1692d8a4a80 | Amanieu d'Antras | 2020-04-09T21:11:45 | Fix documentation link
Fixes #222 | diff --git a/src/remutex.rs b/src/remutex.rs
index c012643..1037923 100644
--- a/src/remutex.rs
+++ b/src/remutex.rs
@@ -36,7 +36,7 @@ unsafe impl GetThreadId for RawThreadId {
/// - `ReentrantMutexGuard` does not give mutable references to the locked data.
/// Use a `RefCell` if you need this.
///
-/// See [`Mute... | 1 | 1 | 1 |
dce000d302198586d1dee440129c69dbf81390f1 | Amanieu d'Antras | 2020-04-06T20:31:19 | Use llvm_asm! instead of asm! | diff --git a/src/elision.rs b/src/elision.rs
index 74ff5ff..68cfa63 100644
--- a/src/elision.rs
+++ b/src/elision.rs
@@ -57,11 +57,11 @@ impl AtomicElisionExt for AtomicUsize {
fn elision_compare_exchange_acquire(&self, current: usize, new: usize) -> Result<usize, usize> {
unsafe {
let prev: ... | 2 | 21 | 21 |
b62d1f5518a205ab41376c8eaabc86dccc309fcf | Christopher Serr | 2020-02-19T10:29:13 | Address the review comments
This splits the doc comments into multiple paragraphs and renames the
helpers to create the locking primitives to `const_*` instead of
`new_*`. | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index 951ff0e..352ac31 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -132,8 +132,9 @@ impl<R: RawMutex, T> Mutex<R, T> {
}
impl<R, T> Mutex<R, T> {
- /// Creates a new mutex based on a pre-existing raw mutex. This allows
- /// crea... | 8 | 35 | 30 |
c20495bcc5b3e26cd835ec52aea917b44724d7c3 | Christopher Serr | 2020-02-18T09:41:27 | Add convenience const constructors to `parking_lot`
This adds various helper functions to `parking_lot` that allow creating
parking_lot's mutexes, reentrant mutexes, fair mutexes and RwLocks in
constant contexts on stable Rust. | diff --git a/src/fair_mutex.rs b/src/fair_mutex.rs
index 5c2cded..74951bd 100644
--- a/src/fair_mutex.rs
+++ b/src/fair_mutex.rs
@@ -80,6 +80,12 @@ use lock_api;
/// ```
pub type FairMutex<T> = lock_api::Mutex<RawFairMutex, T>;
+/// Creates a new fair mutex in an unlocked state ready for use. This allows
+/// creat... | 5 | 35 | 6 |
a9961d4ec400ef54a49183f9063ddf40f2ca23e7 | Christopher Serr | 2020-02-18T09:38:33 | Add new `const_new` function to `lock_api`
This new constructor allows creating mutexes, reentrant mutexes and
RwLocks in a constant context on stable Rust by manually passing in the
underlying raw mutex / rwlock. | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index aa02bb0..951ff0e 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -95,7 +95,7 @@ pub unsafe trait RawMutexTimed: RawMutex {
/// it is protecting. The data can only be accessed through the RAII guards
/// returned from `lock` and `try_lo... | 3 | 51 | 4 |
a02c309357b16757dc33f17e3a024c52dfbfe461 | Tomasz Miąsko | 2020-01-22T00:00:00 | Synchronize on compare_exchange failure in create_hashtable | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index 25e2a30..fb87aef 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -216,8 +216,8 @@ fn create_hashtable() -> &'static HashTable {
let table = match HASHTABLE.compare_exchange(
ptr::null_mut(),
new_table,
- ... | 1 | 2 | 2 |
611b433e9ccb9bbb84ed9a5ebdc3baf7ec726bbb | Michael Bradley | 2020-01-12T23:56:32 | Fix `try_lock` implementation in `lock_api` example | diff --git a/lock_api/src/lib.rs b/lock_api/src/lib.rs
index d388d8a..6576546 100644
--- a/lock_api/src/lib.rs
+++ b/lock_api/src/lib.rs
@@ -47,7 +47,9 @@
//! }
//!
//! fn try_lock(&self) -> bool {
-//! self.0.swap(true, Ordering::Acquire)
+//! self.0
+//! .compare_exchange(false,... | 1 | 3 | 1 |
67e8e6e8cb5b792d658d1aba99a11b253a90027a | Michael Bradley | 2020-01-12T23:55:00 | Add documentation for `try_lock` return | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index 116438e..aa02bb0 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -40,7 +40,8 @@ pub unsafe trait RawMutex {
/// Acquires this mutex, blocking the current thread until it is able to do so.
fn lock(&self);
- /// Attempts to ... | 1 | 2 | 1 |
28fe4716f64ea1cd5cf3153f166cc2f3171e35d2 | Josh Stone | 2020-01-16T21:21:44 | Upgrade petgraph to 0.5 | diff --git a/core/Cargo.toml b/core/Cargo.toml
index 7c0eb5e..709582e 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -12,7 +12,7 @@ edition = "2018"
[dependencies]
cfg-if = "0.1.5"
smallvec = "1.0"
-petgraph = { version = "0.4.5", optional = true }
+petgraph = { version = "0.5", optional = true }
thread-id =... | 1 | 1 | 1 |
59c43a3a05988437b62829df8485b65d32fab27b | Edwin Amsler | 2020-01-13T05:58:48 | Fixed comment typo. "and" -> "an" | diff --git a/src/condvar.rs b/src/condvar.rs
index 149ec86..0afda3a 100644
--- a/src/condvar.rs
+++ b/src/condvar.rs
@@ -81,7 +81,7 @@ impl WaitTimeoutResult {
/// if !*started {
/// cvar.wait(&mut started);
/// }
-/// // Note that we used and if instead of a while loop above. This is only
+/// // Note that we u... | 1 | 1 | 1 |
32d8f7f1a44b08d1e54abcfd9bfeef97ec15589b | Amanieu d'Antras | 2020-01-09T23:51:14 | Add test and comment for #203 | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index 8d05fb3..25e2a30 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -1198,6 +1198,11 @@ mod deadlock_impl {
pub unsafe fn release_resource(key: usize) {
with_thread_data(|thread_data| {
let resources = &mu... | 2 | 29 | 0 |
2e5a7f8d40f90abd5f5ad5d670ef580dc619b140 | Paulo | 2020-01-07T15:49:20 | Update docs | diff --git a/src/fair_mutex.rs b/src/fair_mutex.rs
index b4d7510..5c2cded 100644
--- a/src/fair_mutex.rs
+++ b/src/fair_mutex.rs
@@ -17,14 +17,21 @@ use lock_api;
/// returned from `lock` and `try_lock`, which guarantees that the data is only
/// ever accessed when the mutex is locked.
///
-/// The regular mutex pro... | 1 | 14 | 7 |
53db7de2a9d6521ae5647921f91763e2860dd9e6 | Paulo | 2020-01-07T15:37:19 | Update FairMutex docs | diff --git a/src/fair_mutex.rs b/src/fair_mutex.rs
index 138b918..b4d7510 100644
--- a/src/fair_mutex.rs
+++ b/src/fair_mutex.rs
@@ -8,7 +8,7 @@
use crate::raw_fair_mutex::RawFairMutex;
use lock_api;
-/// A always fair mutual exclusion primitive useful for protecting shared data
+/// A mutual exclusive primitive th... | 1 | 10 | 5 |
2c1464d31ab01f1b50b3887b577f3a3c6456e65a | Paulo | 2020-01-06T19:15:51 | Fix FairMutex debug | diff --git a/src/fair_mutex.rs b/src/fair_mutex.rs
index 1dd4857..138b918 100644
--- a/src/fair_mutex.rs
+++ b/src/fair_mutex.rs
@@ -239,9 +239,9 @@ mod tests {
fn test_mutex_debug() {
let mutex = FairMutex::new(vec![0u8, 10]);
- assert_eq!(format!("{:?}", mutex), "FairMutex { data: [0, 10] }");
... | 1 | 2 | 2 |
059dac57a5db6bde92ef060ae9305417c5a303c7 | Paulo | 2020-01-06T18:15:56 | Remove condvar test | diff --git a/src/fair_mutex.rs b/src/fair_mutex.rs
index 6ca017c..1dd4857 100644
--- a/src/fair_mutex.rs
+++ b/src/fair_mutex.rs
@@ -86,7 +86,7 @@ pub type MappedFairMutexGuard<'a, T> = lock_api::MappedMutexGuard<'a, RawFairMut
#[cfg(test)]
mod tests {
- use crate::{Condvar, FairMutex};
+ use crate::FairMutex... | 1 | 1 | 29 |
92c996fcf3afb09354fb6e0b6236244ac5a1a51d | Paulo | 2020-01-06T18:05:54 | Create API for mutex that is always fair | diff --git a/src/fair_mutex.rs b/src/fair_mutex.rs
new file mode 100644
index 0000000..6ca017c
--- /dev/null
+++ b/src/fair_mutex.rs
@@ -0,0 +1,287 @@
+// Copyright 2016 Amanieu d'Antras
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT lic... | 3 | 351 | 0 |
2afab639d130957c51385788524c4b6f00a8a648 | zhangli.pear | 2020-01-06T16:09:56 | fix: not panic in destructor | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index e91b665..8d05fb3 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -1198,10 +1198,9 @@ mod deadlock_impl {
pub unsafe fn release_resource(key: usize) {
with_thread_data(|thread_data| {
let resources = &mu... | 1 | 3 | 4 |
8f69413ae8271a2a2e9067e61392938f6dadd59c | Amanieu d'Antras | 2020-01-04T10:51:17 | Bump lock_api version to 0.3.3 | diff --git a/lock_api/Cargo.toml b/lock_api/Cargo.toml
index 190953e..a0618ba 100644
--- a/lock_api/Cargo.toml
+++ b/lock_api/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "lock_api"
-version = "0.3.2"
+version = "0.3.3"
authors = ["Amanieu d'Antras <amanieu@gmail.com>"]
description = "Wrappers to create fully-featur... | 1 | 1 | 1 |
d1b446948870dc41feda88dadfe3e9e9b14cabee | Amanieu d'Antras | 2020-01-03T22:50:34 | Mark MappedRwLockWriteGuard::downgrade as deprecated
See #198 | diff --git a/lock_api/src/rwlock.rs b/lock_api/src/rwlock.rs
index f19d586..0707e3c 100644
--- a/lock_api/src/rwlock.rs
+++ b/lock_api/src/rwlock.rs
@@ -1535,6 +1535,10 @@ impl<'a, R: RawRwLockDowngrade + 'a, T: ?Sized + 'a> MappedRwLockWriteGuard<'a,
/// Note that if there are any writers currently waiting to tak... | 1 | 4 | 0 |
df64cff3cea0f46b8ca7299fc4e6ecb986e36066 | Linus Färnstrand | 2019-11-25T21:54:31 | Sort use statements alphabetically in example | diff --git a/src/mutex.rs b/src/mutex.rs
index 82f1fe5..6560819 100644
--- a/src/mutex.rs
+++ b/src/mutex.rs
@@ -53,10 +53,9 @@ use lock_api;
/// # Examples
///
/// ```
-/// use std::sync::Arc;
/// use parking_lot::Mutex;
+/// use std::sync::{Arc, mpsc::channel};
/// use std::thread;
-/// use std::sync::mpsc::chan... | 1 | 1 | 2 |
f2b21e1aa56cc30815d36b02c933ed83572a9f79 | Linus Färnstrand | 2019-11-25T18:53:58 | checked_duration_since is stable. Remove from feature gate | diff --git a/core/src/lib.rs b/core/src/lib.rs
index 6fad780..ba4cb1e 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -49,11 +49,11 @@
target_arch = "wasm32",
target_feature = "atomics"
),
- feature(checked_duration_since, stdsimd)
+ feature(stdsimd)
)]
#![cfg_attr(
all(feature... | 1 | 2 | 2 |
e0cdcdc67952a767cae55a8e6293c56f492ae345 | Linus Färnstrand | 2019-11-24T21:01:02 | Remove unused autocfg dependency
Usage of this was removed in commit da4df87 PR #189 | diff --git a/Cargo.toml b/Cargo.toml
index 1e9230b..53a949b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,9 +21,6 @@ lazy_static = "1.0"
# Used when testing out serde support.
bincode = {version = "1.1.3"}
-[build-dependencies]
-autocfg = "0.1.6"
-
[features]
default = []
owning_ref = ["lock_api/owning_ref"]
d... | 2 | 0 | 6 |
74de9bc84d2face23ea9d821571b4714b6475fdb | Linus Färnstrand | 2019-11-24T20:41:53 | Test with integer instead of unit type
Clippy complained that:
`assert_eq` of unit values detected. This will always succeed | diff --git a/src/remutex.rs b/src/remutex.rs
index 615232e..6fdf107 100644
--- a/src/remutex.rs
+++ b/src/remutex.rs
@@ -69,18 +69,18 @@ mod tests {
#[test]
fn smoke() {
- let m = ReentrantMutex::new(());
+ let m = ReentrantMutex::new(2);
{
let a = m.lock();
... | 1 | 4 | 4 |
bb9a9b12bc43bb674c8085a0c3730447fbe74e25 | Linus Färnstrand | 2019-11-24T20:40:33 | Remove let binding for Condition::wait unit return type | diff --git a/src/condvar.rs b/src/condvar.rs
index 8538b99..149ec86 100644
--- a/src/condvar.rs
+++ b/src/condvar.rs
@@ -618,7 +618,7 @@ mod tests {
rx.recv().unwrap();
let _g = m.lock();
let _guard = PanicGuard(&*c);
- let _ = c.wait(&mut m3.lock());
+ c.wait(&mut m3.lock());
... | 1 | 1 | 1 |
26bd296cc7c4d10069bc843d1891e2060476f91f | Linus Färnstrand | 2019-11-24T20:40:05 | Remove superfluous unit return type from closures | diff --git a/src/mutex.rs b/src/mutex.rs
index 4f88e58..82f1fe5 100644
--- a/src/mutex.rs
+++ b/src/mutex.rs
@@ -245,7 +245,7 @@ mod tests {
fn test_mutex_arc_access_in_unwind() {
let arc = Arc::new(Mutex::new(1));
let arc2 = arc.clone();
- let _ = thread::spawn(move || -> () {
+ le... | 2 | 2 | 2 |
b5341c19b198777830904e5b55577bbaf15ca352 | Linus Färnstrand | 2019-11-24T20:39:44 | Add visual separators to large numbers | diff --git a/src/condvar.rs b/src/condvar.rs
index 90f7ab9..8538b99 100644
--- a/src/condvar.rs
+++ b/src/condvar.rs
@@ -917,7 +917,7 @@ mod webkit_queue_test {
num_producers: 1,
num_consumers: 1,
max_queue_size: 1,
- messages_per_producer: 100000,
+ messages... | 1 | 8 | 8 |
4194f86d31b595089713e48f37f44557c11d517f | Linus Färnstrand | 2019-11-24T20:34:01 | Make methods on tiny copy types take ownership instead of reference | diff --git a/src/condvar.rs b/src/condvar.rs
index c99f2eb..90f7ab9 100644
--- a/src/condvar.rs
+++ b/src/condvar.rs
@@ -24,7 +24,7 @@ pub struct WaitTimeoutResult(bool);
impl WaitTimeoutResult {
/// Returns whether the wait was known to have timed out.
#[inline]
- pub fn timed_out(&self) -> bool {
+ p... | 2 | 5 | 5 |
5e501058023fb527c6a14aeb70367e4731d02cd7 | Emīls | 2019-11-22T16:02:32 | Specify tests with a macro | diff --git a/src/condvar.rs b/src/condvar.rs
index 45f0fba..c99f2eb 100644
--- a/src/condvar.rs
+++ b/src/condvar.rs
@@ -693,8 +693,8 @@ mod tests {
}
}
-/// This module contains an integration test that is verbatim stolen from WebKit's Condvar
-/// integration test. It's a thread-safe Queue that should
+/// Th... | 1 | 149 | 180 |
3c73dd4b4b9f795c0c4b0476630bb98d4b39f4fd | Emīls | 2019-11-22T14:06:02 | Move Queue test into it's own module | diff --git a/src/condvar.rs b/src/condvar.rs
index dc5cfc0..45f0fba 100644
--- a/src/condvar.rs
+++ b/src/condvar.rs
@@ -691,10 +691,18 @@ mod tests {
assert_eq!(rx.recv_timeout(Duration::from_millis(500)), Ok(()));
}
}
+}
+
+/// This module contains an integration test that is verbatim stole... | 1 | 26 | 19 |
e63c388bbc551f5d866500cde5c4c0fd8a4e8a6b | Emīls Piņķis | 2019-11-21T22:50:35 | Add integration tests for Condvar | diff --git a/src/condvar.rs b/src/condvar.rs
index 506a877..dc5cfc0 100644
--- a/src/condvar.rs
+++ b/src/condvar.rs
@@ -691,4 +691,386 @@ mod tests {
assert_eq!(rx.recv_timeout(Duration::from_millis(500)), Ok(()));
}
}
+
+ #[derive(Clone, Copy)]
+ enum Timeout {
+ Bounded(std::t... | 1 | 382 | 0 |
e716214c088b0cdd49b6b314ab27f04e8555ffc4 | Linus Färnstrand | 2019-11-16T14:14:23 | Reformat tests to be <=100 chars wide | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index 15baa55..e91b665 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -1439,18 +1439,42 @@ mod tests {
}
test! {
- unpark_all_one_fast(repeats: 10000, latches: 1, delay: 0, threads: 1, single_unparks: 0);
- u... | 1 | 36 | 12 |
fba8d10dc59213d173d93d3a2fda10807b4e6a50 | Linus Färnstrand | 2019-11-16T14:05:15 | Implement test without relying on std Mutex/Condvar | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index fb7df0f..15baa55 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -1396,8 +1396,8 @@ mod tests {
use std::{
ptr,
sync::{
- atomic::{AtomicIsize, AtomicPtr, Ordering},
- Arc, Condvar, Mu... | 1 | 22 | 29 |
1f7537571b0f525713f070516538de2bde56d73f | Linus Färnstrand | 2019-11-12T22:11:26 | Add parking_lot_core tests inspired by WTF::ParkingLot | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index f2bb209..fb7df0f 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -1389,3 +1389,259 @@ mod deadlock_impl {
cycles.iter().cloned().collect()
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::{ThreadData, DEFAULT_PARK_... | 1 | 256 | 0 |
da4df8700cb9390cb8455b661f94b403027bdf7d | Linus Färnstrand | 2019-11-05T20:37:32 | Remove pre 1.36 backwards compatibility code | diff --git a/build.rs b/build.rs
deleted file mode 100644
index e014fbb..0000000
--- a/build.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-fn main() {
- let cfg = autocfg::new();
- if cfg.probe_rustc_version(1, 34) {
- println!("cargo:rustc-cfg=has_sized_atomics");
- println!("cargo:rustc-cfg=has_checked_instan... | 11 | 23 | 98 |
22697169ab05be86a56e19c1c2e7891fdbc34216 | messense | 2019-11-04T07:27:18 | Bump smallvec version to 1.0 | diff --git a/core/Cargo.toml b/core/Cargo.toml
index ed93817..b195cd9 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -11,7 +11,7 @@ edition = "2018"
[dependencies]
cfg-if = "0.1.5"
-smallvec = "0.6"
+smallvec = "1.0"
petgraph = { version = "0.4.5", optional = true }
thread-id = { version = "3.2.0", optiona... | 1 | 1 | 1 |
617c98886e2abb1a6ad6e0f120bb7dc4571a921c | Linus Färnstrand | 2019-10-09T18:13:14 | Mark grow_hashtable as safe. Extract linked list handling | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index d122a40..f2bb209 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -153,9 +153,7 @@ impl ThreadData {
// Keep track of the total number of live ThreadData objects and resize
// the hash table accordingly.
... | 1 | 49 | 37 |
d6e110d96d755604372a8140ff75509844459508 | Linus Färnstrand | 2019-10-09T17:18:16 | Tiny lock_bucket simplifications | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index 5c45dce..d122a40 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -320,12 +320,11 @@ fn hash(key: usize, bits: u32) -> usize {
/// The returned bucket must be unlocked again in order to not cause deadlocks.
#[inline]
fn lock_bu... | 1 | 8 | 10 |
34b9ac208315413e713a1c525adb8384c0b67d76 | Linus Färnstrand | 2019-10-04T06:53:47 | Use normal #[inline] instead of with (always) | diff --git a/core/src/maybe_uninit.rs b/core/src/maybe_uninit.rs
index 371a21b..2562e3c 100644
--- a/core/src/maybe_uninit.rs
+++ b/core/src/maybe_uninit.rs
@@ -19,22 +19,22 @@ pub union MaybeUninit<T: Copy> {
#[cfg(not(has_maybe_uninit))]
impl<T: Copy> MaybeUninit<T> {
- #[inline(always)]
+ #[inline]
pu... | 1 | 4 | 4 |
1824256b22bb6da8116061725e566404e0e77977 | Linus Färnstrand | 2019-10-03T20:33:04 | Replace mem::uninitialized with MaybeUninit everywhere | diff --git a/core/src/thread_parker/cloudabi.rs b/core/src/thread_parker/cloudabi.rs
index d5be2f2..a319552 100644
--- a/core/src/thread_parker/cloudabi.rs
+++ b/core/src/thread_parker/cloudabi.rs
@@ -5,6 +5,7 @@
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or dist... | 3 | 38 | 29 |
a5d61df694d42ec4c311fd9029ea96b3fa11d788 | Linus Färnstrand | 2019-10-03T20:32:00 | Vendor MaybeUninit from libcore for old Rust versions | diff --git a/core/build.rs b/core/build.rs
index 65e590a..19bdd7a 100644
--- a/core/build.rs
+++ b/core/build.rs
@@ -3,4 +3,7 @@ fn main() {
if cfg.probe_rustc_version(1, 34) {
println!("cargo:rustc-cfg=has_sized_atomics");
}
+ if cfg.probe_rustc_version(1, 36) {
+ println!("cargo:rustc-cfg... | 3 | 45 | 0 |
493b2607699094610e777ed1fae2f66b206cd97f | Linus Färnstrand | 2019-10-03T07:30:08 | Fix deadlock detection for new get_hashtable | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index 63f6a28..5c45dce 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -1256,19 +1256,19 @@ mod deadlock_impl {
let mut table = get_hashtable();
loop {
// Lock all buckets in the old table
- fo... | 1 | 5 | 5 |
cb5a15ab53062907bb317782c741a9857523c7bb | Linus Färnstrand | 2019-10-03T07:09:05 | Add lock_bucket documentation | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index 584bee2..63f6a28 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -316,7 +316,8 @@ fn hash(key: usize, bits: u32) -> usize {
key.wrapping_mul(0x9E3779B97F4A7C15) >> (64 - bits)
}
-// Lock the bucket for the given key
+/// ... | 1 | 10 | 4 |
3dccdaae3f349c4c8f56cc978eae1037ba1623ba | Linus Färnstrand | 2019-10-01T21:50:05 | Add documentation safety section to unlock_bucket_pair | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index 2ab1969..584bee2 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -413,7 +413,11 @@ fn lock_bucket_pair(key1: usize, key2: usize) -> (&'static Bucket, &'static Buck
}
}
-// Unlock a pair of buckets
+/// Unlock a pair of bu... | 1 | 8 | 1 |
5b18ae3aca8e07c6f737a536afa2128b732945be | Linus Färnstrand | 2019-10-01T21:40:38 | Make lock_bucket functions not unsafe | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index f8e9c92..2ab1969 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -318,13 +318,13 @@ fn hash(key: usize, bits: u32) -> usize {
// Lock the bucket for the given key
#[inline]
-unsafe fn lock_bucket<'a>(key: usize) -> &'a Bucket... | 1 | 19 | 16 |
6a1118a0e2b4101acbb7a8cfe2676203af945043 | Linus Färnstrand | 2019-10-01T21:25:34 | Make {get,create}_hashtable return static reference | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index f4bc560..f8e9c92 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -191,27 +191,31 @@ impl Drop for ThreadData {
}
}
-// Get a pointer to the latest hash table, creating one if it doesn't exist yet.
+/// Returns a reference... | 1 | 24 | 14 |
c62db64ec0b044f462fc5021c3148ebbd9a72ec9 | Geoffry Song | 2019-10-03T04:27:58 | Fix some typos in doc comments | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index a2822b1..116438e 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -370,14 +370,14 @@ impl<'a, R: RawMutex + 'a, T: ?Sized + 'a> MutexGuard<'a, R, T> {
}
}
- /// Attempts to make a new `MappedMutexGuard` for a component... | 1 | 7 | 7 |
e891989a8fdd2024ddbe30d3162535d9bb68b0e0 | Linus Färnstrand | 2019-10-01T21:54:51 | Add safety notice to all bucket mutex unlocks | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index 2569953..f4bc560 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -253,6 +253,7 @@ unsafe fn grow_hashtable(num_threads: usize) {
// Unlock buckets and try again
for b in &(*old_table).entries[..] {
+ ... | 1 | 14 | 0 |
bdd9aec8661e6064cb8216f503d08398f11de27c | Linus Färnstrand | 2019-10-02T20:42:18 | Add documentation to HASHTABLE static | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index 82f48fa..2569953 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -17,6 +17,13 @@ use smallvec::SmallVec;
use std::time::{Duration, Instant};
static NUM_THREADS: AtomicUsize = AtomicUsize::new(0);
+
+/// Holds the pointer to t... | 1 | 7 | 0 |
873bf27df23d0adc25f2fdb34d9c07827861da09 | David Kellum | 2019-10-02T17:07:01 | Upgrade _core dep (from parking_lot) to latest 0.6.2 | diff --git a/Cargo.toml b/Cargo.toml
index d536e4a..1e9230b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,7 +11,7 @@ categories = ["concurrency"]
edition = "2018"
[dependencies]
-parking_lot_core = { path = "core", version = "0.6" }
+parking_lot_core = { path = "core", version = "0.6.2" }
lock_api = { path = "lo... | 1 | 1 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.