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 |
|---|---|---|---|---|---|---|---|
7b173d3a3613b26ba246781f539fc079d94e66fb | Linus Färnstrand | 2019-10-02T05:13:35 | Don't duplicate create_hashtable code in grow_hashtable
The only time the special case of a null HashTable will
happen is on the very first call. No need to optimize for it. | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index 4a7ab2a..82f48fa 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -225,32 +225,8 @@ fn create_hashtable() -> *mut HashTable {
// This isn't performance-critical since it is only done when a ThreadData is
// created, which only h... | 1 | 3 | 25 |
74b3ca4bb76b34a8b3ba09b6732daed76a10e515 | Linus Färnstrand | 2019-09-27T22:14:17 | Remove debug_assert that strictly speaking broke safety invariants | diff --git a/src/raw_rwlock.rs b/src/raw_rwlock.rs
index 727d223..8c1ad11 100644
--- a/src/raw_rwlock.rs
+++ b/src/raw_rwlock.rs
@@ -713,16 +713,15 @@ impl RawRwLock {
// just need to wake up a potentially sleeping pending writer.
// Using the 2nd key at addr + 1
let addr = self as *const _ a... | 1 | 2 | 3 |
12b4eb6956e1d4568439d64b0e809a086d91ade1 | Linus Färnstrand | 2019-09-27T21:05:51 | Make lock_common safe again by not allowing arbitrary closure | diff --git a/src/raw_rwlock.rs b/src/raw_rwlock.rs
index a6d8721..727d223 100644
--- a/src/raw_rwlock.rs
+++ b/src/raw_rwlock.rs
@@ -616,12 +616,14 @@ impl RawRwLock {
}
}
};
- let validate = |state| state & (WRITER_BIT | UPGRADABLE_BIT) != 0;
// Step 1: grab exc... | 1 | 21 | 23 |
f9b1b58318c8d95a1e4b691e40067eba344912f8 | Linus Färnstrand | 2019-09-27T19:57:27 | Reduce number of unsafe lines in unlock_shared_slow | diff --git a/src/raw_rwlock.rs b/src/raw_rwlock.rs
index 2d0c4b5..a6d8721 100644
--- a/src/raw_rwlock.rs
+++ b/src/raw_rwlock.rs
@@ -712,16 +712,19 @@ impl RawRwLock {
fn unlock_shared_slow(&self) {
// At this point WRITER_PARKED_BIT is set and READER_MASK is empty. We
// just need to wake up a p... | 1 | 12 | 9 |
5b4c4dfc37a41bbb497afff4d87957da34c2e6a9 | Linus Färnstrand | 2019-09-27T20:17:17 | Mark lock_common as unsafe and explain requirements | diff --git a/src/raw_rwlock.rs b/src/raw_rwlock.rs
index 1e8d551..2d0c4b5 100644
--- a/src/raw_rwlock.rs
+++ b/src/raw_rwlock.rs
@@ -598,30 +598,30 @@ impl RawRwLock {
#[cold]
fn lock_exclusive_slow(&self, timeout: Option<Instant>) -> bool {
- // Step 1: grab exclusive ownership of WRITER_BIT
- ... | 1 | 106 | 105 |
6322bf7ef41977c22c87aafdebe57dffcc681272 | Linus Färnstrand | 2019-09-27T20:12:57 | Use impl Trait instead of named generics in lock_common | diff --git a/src/raw_rwlock.rs b/src/raw_rwlock.rs
index 47266a5..1e8d551 100644
--- a/src/raw_rwlock.rs
+++ b/src/raw_rwlock.rs
@@ -1046,17 +1046,13 @@ impl RawRwLock {
// Common code for acquiring a lock
#[inline]
- fn lock_common<F, V>(
+ fn lock_common(
&self,
timeout: Option<Ins... | 1 | 4 | 8 |
9e46787ad535c36cc4acdb9e3fbd3469ebe31946 | Linus Färnstrand | 2019-09-27T20:11:18 | Reduce and explain unsafe usage in lock_common | diff --git a/src/raw_rwlock.rs b/src/raw_rwlock.rs
index e149c79..47266a5 100644
--- a/src/raw_rwlock.rs
+++ b/src/raw_rwlock.rs
@@ -1085,40 +1085,39 @@ impl RawRwLock {
}
// Park our thread until we are woken up by an unlock
- unsafe {
- let addr = self as *const _... | 1 | 30 | 31 |
c813778b34101e1f43eab563442700980bc5cca9 | Linus Färnstrand | 2019-09-27T20:08:24 | Reduce and explain unsafe usage in wait_for_readers | diff --git a/src/raw_rwlock.rs b/src/raw_rwlock.rs
index 18f3826..e149c79 100644
--- a/src/raw_rwlock.rs
+++ b/src/raw_rwlock.rs
@@ -984,52 +984,60 @@ impl RawRwLock {
}
// Park our thread until we are woken up by an unlock
- unsafe {
- // Using the 2nd key at addr ... | 1 | 44 | 36 |
8aa3a111d9fa2459f12fd5fe5d8ae499ebc4025d | Linus Färnstrand | 2019-09-27T19:58:08 | Mark wake_parked_threads unsafe and explain safety requirements | diff --git a/src/raw_rwlock.rs b/src/raw_rwlock.rs
index 1f35014..18f3826 100644
--- a/src/raw_rwlock.rs
+++ b/src/raw_rwlock.rs
@@ -652,7 +652,10 @@ impl RawRwLock {
TOKEN_NORMAL
}
};
- self.wake_parked_threads(0, callback);
+ // SAFETY: `callback` does not panic or... | 1 | 52 | 32 |
49e61d2cb3898a4827c107878f57747e23c0db3e | Linus Färnstrand | 2019-09-26T05:48:41 | Mark interior mutable consts as allowed
This use case of interior mutable constants is legit. It's just a
legacy way of supplying static items. But it's good to explicitly
tell clippy this is OK and document why. So readers understand this.
Can hopefully be replaced with a const fn constructor at some point | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index 7bea1d8..4a7ab2a 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -72,7 +72,7 @@ impl Bucket {
#[inline]
pub fn new(timeout: Instant, seed: u32) -> Self {
Self {
- mutex: WordLock::INIT,
+ ... | 5 | 17 | 5 |
baafe587a0e1540538f21233bae8184f1dba2809 | Linus Färnstrand | 2019-09-25T18:31:10 | Improve RawMutex state docs after feedback | diff --git a/src/raw_mutex.rs b/src/raw_mutex.rs
index 5d83963..436b0fd 100644
--- a/src/raw_mutex.rs
+++ b/src/raw_mutex.rs
@@ -30,8 +30,8 @@ pub(crate) const TOKEN_HANDOFF: UnparkToken = UnparkToken(1);
/// This bit is set in the `state` of a `RawMutex` when that mutex is locked by some thread.
const LOCKED_BIT: ... | 1 | 12 | 6 |
270166bae88a0ca5009845af3bf3f96237be1022 | Linus Färnstrand | 2019-09-25T17:16:03 | Add explaining comments to RawMutex state and its bits | diff --git a/src/raw_mutex.rs b/src/raw_mutex.rs
index f7873ed..5d83963 100644
--- a/src/raw_mutex.rs
+++ b/src/raw_mutex.rs
@@ -28,11 +28,30 @@ pub(crate) const TOKEN_NORMAL: UnparkToken = UnparkToken(0);
// thread directly without unlocking it.
pub(crate) const TOKEN_HANDOFF: UnparkToken = UnparkToken(1);
-const ... | 1 | 21 | 2 |
bf28a7a3ee66902f08c22829e45d65fdca10af5e | Linus Färnstrand | 2019-09-24T21:40:24 | Reformat deadlock docs to have proper Safety section | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index 2496251..7bea1d8 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -1041,7 +1041,10 @@ pub mod deadlock {
/// Acquire a resource identified by key in the deadlock detector
/// Noop if deadlock_detection feature isn't en... | 1 | 10 | 2 |
dea3398851a36cf297808b62adad0f90f63c727c | Linus Färnstrand | 2019-09-24T21:34:54 | Reduce scope of unsafe block and add SAFETY doc | diff --git a/src/raw_mutex.rs b/src/raw_mutex.rs
index 3ca7a93..f7873ed 100644
--- a/src/raw_mutex.rs
+++ b/src/raw_mutex.rs
@@ -220,37 +220,41 @@ impl RawMutex {
}
// Park our thread until we are woken up by an unlock
- unsafe {
- let addr = self as *const _ as usi... | 1 | 50 | 43 |
50a4ec4990c2f50fbb77d69a8a47f07b738e81dc | Linus Färnstrand | 2019-09-24T21:22:15 | Remove #[inline] on function with no body | diff --git a/core/src/thread_parker/mod.rs b/core/src/thread_parker/mod.rs
index f39d639..7b44263 100644
--- a/core/src/thread_parker/mod.rs
+++ b/core/src/thread_parker/mod.rs
@@ -47,7 +47,6 @@ pub trait UnparkHandleT {
///
/// This method is unsafe for the same reason as the unsafe methods in
/// `Thre... | 1 | 0 | 1 |
57a725fbd05cc181dbb756444a1ddc69b6e42acf | Linus Färnstrand | 2019-09-24T06:25:07 | Initialize thread local var in nonzero_thread_id | diff --git a/src/remutex.rs b/src/remutex.rs
index b244f42..615232e 100644
--- a/src/remutex.rs
+++ b/src/remutex.rs
@@ -17,8 +17,9 @@ unsafe impl GetThreadId for RawThreadId {
fn nonzero_thread_id(&self) -> NonZeroUsize {
// The address of a thread-local variable is guaranteed to be unique to the
- ... | 1 | 3 | 2 |
b4776c53874aff7fd55b0a5c106c894d8e63d9ed | Linus Färnstrand | 2019-09-23T21:07:52 | Use full path to lock_api traits in other crates | diff --git a/src/condvar.rs b/src/condvar.rs
index c87acfe..506a877 100644
--- a/src/condvar.rs
+++ b/src/condvar.rs
@@ -12,7 +12,7 @@ use core::{
fmt, ptr,
sync::atomic::{AtomicPtr, Ordering},
};
-use lock_api::RawMutex as RawMutexTrait;
+use lock_api::RawMutex as RawMutex_;
use parking_lot_core::{self, Pa... | 3 | 16 | 20 |
f1d7eb351a6615e358299319c957d0e1c1ac47b0 | Linus Färnstrand | 2019-09-23T20:40:33 | Don't surround UnsafeCell::into_inner with unsafe{} any more
This method has been safe since Rust 1.25.0 | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index 7e0f983..88a9d18 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -122,9 +122,8 @@ impl<R: RawMutex, T> Mutex<R, T> {
/// Consumes this mutex, returning the underlying data.
#[inline]
- #[allow(unused_unsafe)]
pub fn i... | 2 | 2 | 4 |
f32b45a217415d2b66024e121c3873b719815b1b | Linus Färnstrand | 2019-09-23T20:40:00 | Put lock_api::RawLock fields in same order as struct | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index f499da1..7e0f983 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -105,8 +105,8 @@ impl<R: RawMutex, T> Mutex<R, T> {
#[inline]
pub const fn new(val: T) -> Mutex<R, T> {
Mutex {
- data: UnsafeCell::new(val),
... | 1 | 2 | 2 |
2d02504ae02d0e9ff3eb17bc9a441092bbca3baa | Linus Färnstrand | 2019-09-23T20:32:14 | Move serde trait impls out of the way of main code | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index 6ab938d..f499da1 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -96,35 +96,6 @@ pub struct Mutex<R: RawMutex, T: ?Sized> {
data: UnsafeCell<T>,
}
-// Copied and modified from serde
-#[cfg(feature = "serde")]
-impl<R, T> Serializ... | 2 | 60 | 60 |
c08def77a9deac023a5beb2e279c3147c4fa885c | Alex Crichton | 2019-09-19T19:26:57 | Switch from `rustc_version` to `autocfg`
The `autocfg` crate is a bit more robust in terms of how it parses
rustc's version and also doesn't have a dependency on `semver` which can
be a very weighty dependency if its `serde` feature is activated. | diff --git a/Cargo.toml b/Cargo.toml
index 534ab6c..d536e4a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,7 +22,7 @@ lazy_static = "1.0"
bincode = {version = "1.1.3"}
[build-dependencies]
-rustc_version = "0.2"
+autocfg = "0.1.6"
[features]
default = []
diff --git a/build.rs b/build.rs
index 17e76f1..e014fbb ... | 4 | 6 | 8 |
a1a35fd422f699a5bedc9ed1e2c8962f781ff6c9 | Amanieu d'Antras | 2019-08-08T09:49:12 | Fix Condvar example
Fixes #152 | diff --git a/src/condvar.rs b/src/condvar.rs
index aae77e7..c87acfe 100644
--- a/src/condvar.rs
+++ b/src/condvar.rs
@@ -78,9 +78,13 @@ impl WaitTimeoutResult {
/// // wait for the thread to start up
/// let &(ref lock, ref cvar) = &*pair;
/// let mut started = lock.lock();
-/// while !*started {
+/// if !*started {... | 1 | 5 | 1 |
f9398a486b6cd7e41ad98f911bc81085d7958f67 | Rolf Karp | 2019-07-20T14:41:41 | Fix compile errors on windows | diff --git a/core/Cargo.toml b/core/Cargo.toml
index 61601af..6dfc65b 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -10,7 +10,7 @@ categories = ["concurrency"]
edition = "2018"
[dependencies]
-cfg-if = "0.1"
+cfg-if = "0.1.5"
smallvec = "0.6"
petgraph = { version = "0.4.5", optional = true }
thread-id = ... | 1 | 1 | 1 |
333fc77fdefba55b4602ffdc6fcd931251d4ac7e | Amanieu d'Antras | 2019-07-17T08:37:59 | Bump parking_lot_core to 0.6.1 | diff --git a/core/Cargo.toml b/core/Cargo.toml
index 66e1224..61601af 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "parking_lot_core"
-version = "0.6.0"
+version = "0.6.1"
authors = ["Amanieu d'Antras <amanieu@gmail.com>"]
description = "An advanced API for creating custom syn... | 1 | 1 | 1 |
7e95dbbd66854816ef8f9161af10670a5d148e50 | Amanieu d'Antras | 2019-07-17T08:14:53 | Use __errno instead of __errno_location on Android
Fixes #163 | diff --git a/core/src/thread_parker/linux.rs b/core/src/thread_parker/linux.rs
index 576b066..04f66a7 100644
--- a/core/src/thread_parker/linux.rs
+++ b/core/src/thread_parker/linux.rs
@@ -21,6 +21,17 @@ type tv_nsec_t = i64;
#[allow(non_camel_case_types)]
type tv_nsec_t = libc::c_long;
+fn errno() -> libc::c_int {... | 1 | 17 | 8 |
5539a58f5983df4586e86215831a5355a2df80cf | David Kellum | 2019-07-11T19:35:23 | upgrade rand (dev) dep to 0.7 | diff --git a/Cargo.toml b/Cargo.toml
index ba6688c..06ec80f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,7 +15,7 @@ parking_lot_core = { path = "core", version = "0.5" }
lock_api = { path = "lock_api", version = "0.3" }
[dev-dependencies]
-rand = "0.6"
+rand = "0.7"
lazy_static = "1.0"
# Used when testing ou... | 1 | 1 | 1 |
da16c2c7709e3c97df9b1ca34e2811f320dddec4 | Amanieu d'Antras | 2019-07-12T07:01:34 | Fix race condition in ReentrantMutex | diff --git a/lock_api/src/remutex.rs b/lock_api/src/remutex.rs
index 331bded..69dcf01 100644
--- a/lock_api/src/remutex.rs
+++ b/lock_api/src/remutex.rs
@@ -86,11 +86,11 @@ impl<R: RawMutex, G: GetThreadId> RawReentrantMutex<R, G> {
#[inline]
fn unlock(&self) {
let lock_count = self.lock_count.get() ... | 1 | 2 | 2 |
ace8280969b6362c3f3753506d90122c358de580 | Amanieu d'Antras | 2019-07-03T02:24:28 | Bump lock_api version to 0.3.0 | diff --git a/Cargo.toml b/Cargo.toml
index 67f89bb..ba6688c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,7 @@ edition = "2018"
[dependencies]
parking_lot_core = { path = "core", version = "0.5" }
-lock_api = { path = "lock_api", version = "0.2" }
+lock_api = { path = "lock_api", version = "0.3" }
[dev-d... | 2 | 2 | 2 |
7b403d38ce6a09040e672c1cbd8bb80138d83761 | Taiki Endo | 2019-06-09T11:14:17 | Use hint::unreachable_unchecked instead of Void enum | diff --git a/core/src/util.rs b/core/src/util.rs
index c7dfd32..d7aaa87 100644
--- a/core/src/util.rs
+++ b/core/src/util.rs
@@ -20,13 +20,12 @@ impl<T> UncheckedOptionExt<T> for Option<T> {
}
}
-// Equivalent to intrinsics::unreachable() in release mode
+// hint::unreachable_unchecked() in release mode
#[inli... | 2 | 4 | 6 |
2921234b22f8e312550618bc2b5d31c91de11ece | Aleksey Kladov | 2019-06-07T07:18:41 | reexport lock_api crate
That way, folks who use both parking_lot and lock_api will need only
one entry in Cargo.toml, one optional feature and won't suffer from
parking_lot / lock_api version mismatch. | diff --git a/src/lib.rs b/src/lib.rs
index 5e65289..6272a9a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -28,6 +28,7 @@ pub mod deadlock;
#[cfg(not(feature = "deadlock_detection"))]
mod deadlock;
+pub use ::lock_api as lock_api;
pub use self::condvar::{Condvar, WaitTimeoutResult};
pub use self::mutex::{MappedMutex... | 1 | 1 | 0 |
4aa23e59de4d1339b3e7900417a5d8c1c227e592 | Linus Färnstrand | 2019-06-06T11:58:02 | Debug assert lock_count in ReentrantMutex | diff --git a/lock_api/src/remutex.rs b/lock_api/src/remutex.rs
index 54d9d08..331bded 100644
--- a/lock_api/src/remutex.rs
+++ b/lock_api/src/remutex.rs
@@ -64,6 +64,7 @@ impl<R: RawMutex, G: GetThreadId> RawReentrantMutex<R, G> {
return false;
}
self.owner.store(id, Ordering:... | 1 | 3 | 4 |
e616a2703263ca435897d016b9fef65a48cda6a7 | Linus Färnstrand | 2019-06-04T19:05:13 | Add comments explaining we uphold unsafety contracts | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index 92f05b7..95a46fb 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -172,6 +172,7 @@ impl<R: RawMutex, T: ?Sized> Mutex<R, T> {
#[inline]
pub fn lock(&self) -> MutexGuard<'_, R, T> {
self.raw.lock();
+ // SAFETY: T... | 3 | 74 | 10 |
67f83c5c657d3bf5b3b95e0bd112b4206b1435d0 | Linus Färnstrand | 2019-06-03T20:25:45 | Use NonZeroUsize in GetThreadId::nonzero_thread_id | diff --git a/lock_api/src/remutex.rs b/lock_api/src/remutex.rs
index 48d2d93..fb5ebad 100644
--- a/lock_api/src/remutex.rs
+++ b/lock_api/src/remutex.rs
@@ -5,14 +5,19 @@
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.
... | 2 | 21 | 12 |
dbe2380c810211f6fa2342de993ac802b0142bd0 | Linus Färnstrand | 2019-06-03T17:10:57 | Mark internal guard creating methods as unsafe and add explanation | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index a8b98c9..92f05b7 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -152,8 +152,11 @@ impl<R: RawMutex, T> Mutex<R, T> {
}
impl<R: RawMutex, T: ?Sized> Mutex<R, T> {
+ /// # Safety
+ ///
+ /// The lock must be held when calling... | 3 | 68 | 29 |
013e482f51a63ac1bc9b08c2d87f445238adbf8c | Linus Färnstrand | 2019-06-04T19:31:58 | Add new wasm thread parker for non-atomic libstds | diff --git a/core/src/thread_parker/mod.rs b/core/src/thread_parker/mod.rs
index 6753472..f39d639 100644
--- a/core/src/thread_parker/mod.rs
+++ b/core/src/thread_parker/mod.rs
@@ -74,6 +74,9 @@ cfg_if! {
))] {
#[path = "wasm_atomic.rs"]
mod imp;
+ } else if #[cfg(target_arch = "wasm32")] {
+ ... | 2 | 56 | 0 |
a31781b48af3abf9f3f98ac5dcd2269a925b47a0 | Linus Färnstrand | 2019-06-04T19:31:26 | Rename existing wasm ThreadParker | diff --git a/core/src/thread_parker/mod.rs b/core/src/thread_parker/mod.rs
index 129bbee..6753472 100644
--- a/core/src/thread_parker/mod.rs
+++ b/core/src/thread_parker/mod.rs
@@ -72,7 +72,7 @@ cfg_if! {
target_arch = "wasm32",
target_feature = "atomics"
))] {
- #[path = "wasm.rs"]
+ ... | 2 | 1 | 1 |
92498d54503a4784012a7254b7ffbd3337bdfccc | Linus Färnstrand | 2019-05-30T10:48:23 | Remove invalid use of word "random" | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index 738a03c..455aca8 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -95,7 +95,7 @@ impl FairTimeout {
fn should_timeout(&mut self) -> bool {
let now = Instant::now();
if now > self.timeout {
- // Ra... | 1 | 1 | 1 |
757a640c82cd9f87414a316dfde3bc8816d75a3a | Linus Färnstrand | 2019-05-30T10:44:06 | Use incrementing index instead of ptr address as seed | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index f74d565..738a03c 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -42,8 +42,9 @@ impl HashTable {
let now = Instant::now();
let mut entries = Vec::with_capacity(new_size);
- for _ in 0..new_size {
- ... | 1 | 7 | 6 |
4d78285cef7c641532a1bc49a86a3e397c666f95 | Linus Färnstrand | 2019-05-30T09:49:21 | Implement own xorshift PRNG to avoid rand dependency | diff --git a/core/Cargo.toml b/core/Cargo.toml
index 77909df..2c1f3bb 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -12,7 +12,6 @@ edition = "2018"
[dependencies]
cfg-if = "0.1"
smallvec = "0.6"
-rand = "0.6"
petgraph = { version = "0.4.5", optional = true }
thread-id = { version = "3.2.0", optional = true... | 2 | 14 | 6 |
6607fd3cbfea40821fc8f4cbddcf1fc20905c0ff | Linus Färnstrand | 2019-05-20T22:05:11 | Fix CloudABI ThreadParker | diff --git a/core/src/thread_parker/cloudabi.rs b/core/src/thread_parker/cloudabi.rs
index d288d86..8a56848 100644
--- a/core/src/thread_parker/cloudabi.rs
+++ b/core/src/thread_parker/cloudabi.rs
@@ -23,87 +23,88 @@ struct Lock {
}
impl Lock {
- #[inline]
pub fn new() -> Self {
Lock {
... | 1 | 55 | 68 |
c763967095b36228bde965dba348fc6d0885afd3 | Linus Färnstrand | 2019-05-20T21:55:23 | Remove not needed unsafe blocks | diff --git a/core/src/thread_parker/linux.rs b/core/src/thread_parker/linux.rs
index da58b36..41bc909 100644
--- a/core/src/thread_parker/linux.rs
+++ b/core/src/thread_parker/linux.rs
@@ -128,10 +128,10 @@ impl super::UnparkHandleT for UnparkHandle {
// The thread data may have been freed at this point, but i... | 2 | 3 | 3 |
5e2d677e84790ead5a12c749868418576f223a9b | Linus Färnstrand | 2019-05-20T21:47:50 | Use FUTEX_ constants from libc | diff --git a/core/Cargo.toml b/core/Cargo.toml
index 77909df..ccdd35b 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -21,7 +21,7 @@ backtrace = { version = "0.3.2", optional = true }
rustc_version = "0.2"
[target.'cfg(unix)'.dependencies]
-libc = "0.2.27"
+libc = "0.2.55"
[target.'cfg(target_os = "redox")... | 2 | 3 | 7 |
3132b9525e3880568a9a147a965c649a42b4af9a | Linus Färnstrand | 2019-05-16T18:50:34 | Make Android use futex based parker | diff --git a/core/src/thread_parker/mod.rs b/core/src/thread_parker/mod.rs
index 42904ad..129bbee 100644
--- a/core/src/thread_parker/mod.rs
+++ b/core/src/thread_parker/mod.rs
@@ -52,7 +52,7 @@ pub trait UnparkHandleT {
}
cfg_if! {
- if #[cfg(all(has_sized_atomics, target_os = "linux"))] {
+ if #[cfg(all(has... | 1 | 1 | 1 |
2fb27d3583f5919b5d6acf13ebdaed49ce4bc0f9 | Linus Färnstrand | 2019-05-12T22:14:32 | Create a ThreadParker trait, to unify API | diff --git a/core/src/lib.rs b/core/src/lib.rs
index ff438c1..deb198d 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -49,42 +49,9 @@
feature(thread_local, checked_duration_since)
)]
-use cfg_if::cfg_if;
-
-cfg_if! {
- if #[cfg(all(has_sized_atomics, target_os = "linux"))] {
- #[path = "thread_p... | 11 | 219 | 250 |
c162cfcecd298401ada523f6a5dbaf8e1e312c4d | Linus Färnstrand | 2019-05-12T21:36:11 | Remove #[inline(never)] | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index 4bdbeb0..0512304 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -181,7 +181,6 @@ fn get_hashtable() -> *mut HashTable {
// Get a pointer to the latest hash table, creating one if it doesn't exist yet.
#[cold]
-#[inline(never... | 7 | 0 | 25 |
f9f951b35fe5c52288ea889949971b911671c63f | Linus Färnstrand | 2019-05-12T10:36:52 | Format comment | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index 482523b..4bdbeb0 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -556,9 +556,9 @@ pub unsafe fn park(
// Invoke the pre-sleep callback
before_sleep();
- // Park our thread and determine whether we were ... | 1 | 3 | 3 |
c8c5041daf53a5a78dea48dd48da2deef917bb8d | Linus Färnstrand | 2019-05-12T10:34:16 | Use impl trait instead of generic in park | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index d0f1f50..482523b 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -151,10 +151,7 @@ impl ThreadData {
// Invokes the given closure with a reference to the current thread `ThreadData`.
#[inline(always)]
-fn with_thread_data<F, ... | 2 | 20 | 35 |
c775469fd8b2628a11c189cbd3897d51b2974d03 | Linus Färnstrand | 2019-05-12T10:26:33 | Simplify unlock_bucket_pair | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index d686f27..d0f1f50 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -395,13 +395,8 @@ unsafe fn lock_bucket_pair<'a>(key1: usize, key2: usize) -> (&'a Bucket, &'a Buc
// Unlock a pair of buckets
#[inline]
unsafe fn unlock_bucket_... | 1 | 2 | 7 |
4594729e455f9708a8aabaa60a7325413fc04624 | Linus Färnstrand | 2019-05-20T22:15:24 | Run latest rustfmt (1.2.2-nightly) | diff --git a/core/src/lib.rs b/core/src/lib.rs
index 1d599a3..ff438c1 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -39,16 +39,9 @@
#![warn(missing_docs)]
#![warn(rust_2018_idioms)]
+#![cfg_attr(all(target_env = "sgx", target_vendor = "fortanix"), feature(sgx_platform))]
#![cfg_attr(
- all(target_env = ... | 12 | 107 | 426 |
a8d33ee9121a54ecdf8df93590e5f5d2cad0f558 | Linus Färnstrand | 2019-05-03T08:06:56 | Remove unused bincode dependency | diff --git a/lock_api/Cargo.toml b/lock_api/Cargo.toml
index 4ff3287..161104b 100644
--- a/lock_api/Cargo.toml
+++ b/lock_api/Cargo.toml
@@ -18,9 +18,5 @@ owning_ref = { version = "0.4", optional = true }
# support, just pass "--features serde" when building this crate.
serde = {version = "1.0.90", default-features =... | 1 | 0 | 4 |
6ce0c4d952a475f26e5565117905d1b813cf5768 | Linus Färnstrand | 2019-05-03T08:00:55 | Remove extern crate serde and don't wildcard import | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index 7c0a856..12fb368 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -15,9 +15,7 @@ use core::ops::{Deref, DerefMut};
use owning_ref::StableAddress;
#[cfg(feature = "serde")]
-extern crate serde;
-#[cfg(feature = "serde")]
-use self::ser... | 3 | 6 | 12 |
6d4d78c97c78ed6248d2c607eecd04587d9df340 | Cem Karan | 2019-04-30T13:59:04 | Modified lock_api/Cargo.toml so that serde has no dependencies, not even default ones.
@Amanieu pointed out that the `lock_api` crate needs to work in `no_std`
environments; using any dependencies in serde (including the default ones) would
result in the `lock_api` being unusable in `no_std` environments. This change... | diff --git a/lock_api/Cargo.toml b/lock_api/Cargo.toml
index 330c571..0e12ca2 100644
--- a/lock_api/Cargo.toml
+++ b/lock_api/Cargo.toml
@@ -15,7 +15,7 @@ owning_ref = { version = "0.4", optional = true }
# Optional dependency for supporting serde. Use the feature "enable_serde" to
# get access to this.
-serde = {... | 1 | 1 | 1 |
f3be561d4a06c33bd877189b8851f6b946e2adc3 | Cem Karan | 2019-04-30T13:57:32 | Per suggestions from @Amanieu I've removed all dependencies on serde from parking_lot.
This **does not** mean that I've removed the optional dependency from the lock_api,
just from parking_lot. | diff --git a/Cargo.toml b/Cargo.toml
index 80300e5..b99f35e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,10 +14,6 @@ edition = "2018"
parking_lot_core = { path = "core", version = "0.5" }
lock_api = { path = "lock_api", version = "0.2" }
-# Optional dependency for supporting serde. Use the feature "enable_serde... | 2 | 1 | 12 |
bf497c8d3d7e3faabb9a92d70a570ef7cd33a39b | Cem Karan | 2019-04-28T15:38:05 | Reworked use of `.map()` on `Deserialize` implementations.
The original code implemented `Deserialize` as follows:
```rust
Deserialize::deserialize(deserializer).map(|value| Mutex::new(value))
```
@Amanieu suggested that this be changed to:
```rust
Deserialize::deserialize(deserializer).map(Mutex::new)
```
And sim... | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index e0d7e07..499a7d7 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -123,7 +123,7 @@ where
where
D: Deserializer<'de>,
{
- Deserialize::deserialize(deserializer).map(|value| Mutex::new(value))
+ Deserialize:... | 3 | 3 | 3 |
f1345f2610fd31826834e27050e5f49f70d243eb | Cem Karan | 2019-04-28T15:29:06 | Changed lock_api::rwlock::RwLock::serialize() to use self.read() instead of self.write().
@Amanieu reviewed this code and said that we should be using self.read() instead
of self.write() here. This commit makes the change and removes the FIXME
comment. | diff --git a/lock_api/src/rwlock.rs b/lock_api/src/rwlock.rs
index 7733a33..92ebd3c 100644
--- a/lock_api/src/rwlock.rs
+++ b/lock_api/src/rwlock.rs
@@ -246,11 +246,7 @@ where
where
S: Serializer,
{
- // FIXME It may be possible to use self.read() here instead, but using
- // self.write... | 1 | 1 | 5 |
52b61bedc0b204e2be51877078bfd5a26dd5175f | Cem Karan | 2019-04-24T22:32:39 | Added serde support to the lock_api crate, and added tests to verify it works. | diff --git a/Cargo.toml b/Cargo.toml
index 5bad88c..80300e5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,10 +14,17 @@ edition = "2018"
parking_lot_core = { path = "core", version = "0.5" }
lock_api = { path = "lock_api", version = "0.2" }
+# Optional dependency for supporting serde. Use the feature "enable_serd... | 7 | 148 | 0 |
0eb9f691511797df61cdc86beb40d27a427ac1da | Cem Karan | 2019-04-24T22:32:39 | Improved serde mutex tests. | diff --git a/src/mutex.rs b/src/mutex.rs
index bf5b0d2..82416c9 100644
--- a/src/mutex.rs
+++ b/src/mutex.rs
@@ -295,14 +295,12 @@ mod tests {
#[test]
fn test_serde() {
let contents: Vec<u8> = vec![0, 1, 2];
- let serialized = serialize(&contents).unwrap();
- let deserialized: Vec<u8> =... | 1 | 3 | 5 |
fc17f62e8737d476d246d45f19d195777a9fe4b9 | Cem Karan | 2019-04-24T22:31:25 | Bug fix: forgot to set 'lock_api/enable_serde' in the top level Cargo file. | diff --git a/Cargo.toml b/Cargo.toml
index 07173d4..80300e5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -33,7 +33,7 @@ default = []
owning_ref = ["lock_api/owning_ref"]
nightly = ["parking_lot_core/nightly", "lock_api/nightly"]
deadlock_detection = ["parking_lot_core/deadlock_detection"]
-enable_serde = ["serde"]
+e... | 1 | 1 | 1 |
3e8fe2f8e04d6b6616f71390d04737273add860d | Cem Karan | 2019-04-24T22:09:44 | Added test for serde to the Mutex type. | diff --git a/src/mutex.rs b/src/mutex.rs
index f136a3d..bf5b0d2 100644
--- a/src/mutex.rs
+++ b/src/mutex.rs
@@ -111,6 +111,9 @@ mod tests {
use std::sync::Arc;
use std::thread;
+ #[cfg(feature = "enable_serde")]
+ use bincode::{deserialize, serialize};
+
struct Packet<T>(Arc<(Mutex<T>, Condvar)>... | 1 | 18 | 0 |
6e9ca3769aaf0314d06555b1e0877486c0c70de5 | Cem Karan | 2019-04-24T22:07:48 | Removed and hand expanded all forwarded_impl!() macro uses.
forwarded_impl!() was copied from serde's source directly. While it worked
within serde, it didn't appear to work correctly within parking_lot. Hand
expanding the macro and replacing its uses within the code seems to have done
the trick. | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index b44de2b..e0d7e07 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -19,25 +19,6 @@ extern crate serde;
#[cfg(feature = "enable_serde")]
use self::serde::*;
-// Copied and modified from serde
-#[cfg(feature = "enable_serde")]
-macro_rul... | 3 | 45 | 67 |
47316e2f1971f8c868c7d6af99f39729702a38e6 | Cem Karan | 2019-04-24T17:59:48 | Added serde support | diff --git a/lock_api/Cargo.toml b/lock_api/Cargo.toml
index 65d6d4f..330c571 100644
--- a/lock_api/Cargo.toml
+++ b/lock_api/Cargo.toml
@@ -13,5 +13,14 @@ edition = "2018"
scopeguard = { version = "1.0", default-features = false }
owning_ref = { version = "0.4", optional = true }
+# Optional dependency for support... | 1 | 9 | 0 |
6f11c729a8eaf9d5d712c117ab885ced17d26848 | Cem Karan | 2019-04-24T17:59:26 | cargo fmt --all | diff --git a/lock_api/src/remutex.rs b/lock_api/src/remutex.rs
index d085c59..033229a 100644
--- a/lock_api/src/remutex.rs
+++ b/lock_api/src/remutex.rs
@@ -170,7 +170,7 @@ impl<R, G, T> Serialize for ReentrantMutex<R, G, T>
where
R: RawMutex,
G: GetThreadId,
- T: Serialize + ?Sized
+ T: Serialize + ?S... | 2 | 2 | 3 |
b39ec4353685267e419c8af2b1e23ac8ecb50f06 | Cem Karan | 2019-04-24T17:08:42 | Added serde support to remutex::RawThreadId | diff --git a/src/remutex.rs b/src/remutex.rs
index 8d41365..7ed426d 100644
--- a/src/remutex.rs
+++ b/src/remutex.rs
@@ -8,7 +8,14 @@
use crate::raw_mutex::RawMutex;
use lock_api::{self, GetThreadId};
+
+#[cfg(feature = "enable_serde")]
+extern crate serde;
+#[cfg(feature = "enable_serde")]
+use self::serde::*;
+
... | 1 | 7 | 0 |
326c3e7ad8758a37ffba7d84875d7dee71468b6f | Cem Karan | 2019-04-24T17:07:39 | Added imports to Cargo.toml to support testing of serde | diff --git a/Cargo.toml b/Cargo.toml
index ebb6699..07173d4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,7 +14,7 @@ edition = "2018"
parking_lot_core = { path = "core", version = "0.5" }
lock_api = { path = "lock_api", version = "0.2" }
-# Optional dependencies for supporting serde. use the feature "enable_serd... | 1 | 4 | 1 |
87a973a2ab90540a04044f43a2139d815ebe6ed8 | Cem Karan | 2019-04-24T16:37:24 | Bug fix: was deriving Serialize and Deserialize.
It isn't possible to derive Serialize and Deserialize on any of parking_lot's
types as they are variations on mutexes, which will require us to lock them
before we can do anything with them. Moreover, I had already hand implemented
these; the only reason there wasn't a ... | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index 29230ad..b44de2b 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -112,7 +112,6 @@ pub unsafe trait RawMutexTimed: RawMutex {
/// it is protecting. The data can only be accessed through the RAII guards
/// returned from `lock` and `try_... | 3 | 0 | 4 |
7a97c0ed4c87d1a6af5df8b4ae5f450d094eb854 | Cem Karan | 2019-04-24T15:05:30 | Copied and modified how serde handles mutexes into the lock_api.
Serde already has code to handle mutexes. Assuming that the code is implemented
correctly, I've gone ahead and copied it into the lock_api files. This is a
first pass at this modification; I've tested that the current parking_lot tests
all pass as expe... | diff --git a/Cargo.toml b/Cargo.toml
index 5bad88c..ebb6699 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,6 +14,10 @@ edition = "2018"
parking_lot_core = { path = "core", version = "0.5" }
lock_api = { path = "lock_api", version = "0.2" }
+# Optional dependencies for supporting serde. use the feature "enable_ser... | 4 | 140 | 0 |
12b8973a88df37fbd26d609f114b90b59448fde5 | Linus Färnstrand | 2019-04-18T04:41:13 | Make Once and Condvar constructors const fns | diff --git a/src/condvar.rs b/src/condvar.rs
index 30e6cbd..5997967 100644
--- a/src/condvar.rs
+++ b/src/condvar.rs
@@ -89,7 +89,6 @@ pub struct Condvar {
impl Condvar {
/// Creates a new condition variable which is ready to be waited on and
/// notified.
- #[cfg(feature = "nightly")]
#[inline]
... | 3 | 12 | 34 |
696f83fa5e8fa80698cf1fb212a8abf319660203 | Linus Färnstrand | 2019-04-10T19:56:37 | Add version detection for stabilized atomics and checked_add | diff --git a/Cargo.toml b/Cargo.toml
index 4094d96..5bad88c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,6 +18,9 @@ lock_api = { path = "lock_api", version = "0.2" }
rand = "0.6"
lazy_static = "1.0"
+[build-dependencies]
+rustc_version = "0.2"
+
[features]
default = []
owning_ref = ["lock_api/owning_ref"]
dif... | 8 | 48 | 24 |
a59bf953a3dcb9614dd590cbcbdbb0bdd59c18d5 | Linus Färnstrand | 2019-04-07T21:50:16 | Optimize grow_hashtable to call Instant::now() once | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index dd815ca..5779c31 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -40,8 +40,15 @@ impl HashTable {
fn new(num_threads: usize, prev: *const HashTable) -> Box<HashTable> {
let new_size = (num_threads * LOAD_FACTOR).nex... | 1 | 12 | 13 |
de42e90e0ab821dafdf543c3af50dab4ecbf8a6d | Amanieu d'Antras | 2019-04-12T13:25:06 | Add test for deadlock | diff --git a/src/condvar.rs b/src/condvar.rs
index 5e772d3..30e6cbd 100644
--- a/src/condvar.rs
+++ b/src/condvar.rs
@@ -675,4 +675,29 @@ mod tests {
drop(g);
t.join().unwrap();
}
+
+ #[test]
+ fn test_issue_129() {
+ let locks = Arc::new((Mutex::new(()), Condvar::new()));
+
+ ... | 1 | 25 | 0 |
5efe45b451f5f43cc85ef04caf2326e8a588e552 | Amanieu d'Antras | 2019-04-12T13:01:34 | Remove Debug pretty-print tests
The pretty-print format has changed in the latest Rust version. | diff --git a/src/mutex.rs b/src/mutex.rs
index 57ab237..f136a3d 100644
--- a/src/mutex.rs
+++ b/src/mutex.rs
@@ -284,15 +284,6 @@ mod tests {
let mutex = Mutex::new(vec![0u8, 10]);
assert_eq!(format!("{:?}", mutex), "Mutex { data: [0, 10] }");
- assert_eq!(
- format!("{:#?}", mutex... | 4 | 0 | 33 |
fbd45c2a9611350932fcae8d28cfc7b410f72b8f | Amanieu d'Antras | 2019-04-12T12:37:46 | Fix was_last_thread value in the timeout callback of park() | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index d461fbd..dd815ca 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -621,11 +621,11 @@ where
let mut link = &bucket.queue_head;
let mut current = bucket.queue_head.get();
let mut previous = ptr::null();
+ ... | 1 | 4 | 1 |
5a4e373cb893d0784399b9688401430fe00a698e | Linus Färnstrand | 2019-03-30T01:42:33 | Rename Condvar::signal to notify | diff --git a/core/src/thread_parker/cloudabi.rs b/core/src/thread_parker/cloudabi.rs
index 4a8292a..d6d5143 100644
--- a/core/src/thread_parker/cloudabi.rs
+++ b/core/src/thread_parker/cloudabi.rs
@@ -157,7 +157,7 @@ impl Condvar {
}
/// Waits for a signal on the condvar.
- /// Returns false if it times ... | 1 | 3 | 3 |
198d803f72233dcbe6d22ddf7dc999f5604dc65d | Linus Färnstrand | 2019-03-30T01:25:23 | Introduce LockGuard and mark everything as safe | diff --git a/core/src/thread_parker/cloudabi.rs b/core/src/thread_parker/cloudabi.rs
index f145a4e..4a8292a 100644
--- a/core/src/thread_parker/cloudabi.rs
+++ b/core/src/thread_parker/cloudabi.rs
@@ -31,60 +31,81 @@ impl Lock {
}
#[inline]
- unsafe fn try_lock(&self) -> bool {
+ fn try_lock(&self) ->... | 1 | 127 | 108 |
2140458251e5a5e8f8267230ad4b766d105a0d6b | Linus Färnstrand | 2019-03-30T00:41:44 | Add CloudABI ThreadParker implementation | diff --git a/core/Cargo.toml b/core/Cargo.toml
index ff7ddbd..c185917 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -23,6 +23,9 @@ libc = "0.2.27"
[target.'cfg(target_os = "redox")'.dependencies]
redox_syscall = "0.1"
+[target.'cfg(target_os = "cloudabi")'.dependencies]
+cloudabi = "0.0.3"
+
[target.'cfg(w... | 3 | 316 | 0 |
b9600a986bec77429bf130c994f7d54580e2e624 | Linus Färnstrand | 2019-03-31T17:54:09 | Upgrade benchmark crate to Rust 2018 | diff --git a/benchmark/Cargo.toml b/benchmark/Cargo.toml
index 11f8e80..63b0893 100644
--- a/benchmark/Cargo.toml
+++ b/benchmark/Cargo.toml
@@ -2,6 +2,7 @@
name = "parking_lot-benchmark"
version = "0.0.0"
authors = ["Amanieu d'Antras <amanieu@gmail.com>"]
+edition = "2018"
[dependencies]
parking_lot = {path = "... | 4 | 20 | 19 |
eb8614238c4dbdb5ff441224b8273a343d4dae29 | Linus Färnstrand | 2019-03-21T07:25:07 | Add Redox specific ThreadParker based on futex | diff --git a/core/Cargo.toml b/core/Cargo.toml
index 6cd2a3e..ff7ddbd 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -20,6 +20,9 @@ backtrace = { version = "0.3.2", optional = true }
[target.'cfg(unix)'.dependencies]
libc = "0.2.27"
+[target.'cfg(target_os = "redox")'.dependencies]
+redox_syscall = "0.1"
+
... | 3 | 156 | 0 |
e6e791a37320c3a441736769325e3be138a08ab1 | Linus Färnstrand | 2019-03-27T08:41:01 | Use AtomicI32 and debug_assert more return values | diff --git a/core/src/thread_parker/wasm.rs b/core/src/thread_parker/wasm.rs
index e576791..7a9f7ab 100644
--- a/core/src/thread_parker/wasm.rs
+++ b/core/src/thread_parker/wasm.rs
@@ -7,18 +7,17 @@
use core::{
arch::wasm32,
- mem,
- sync::atomic::{AtomicUsize, Ordering},
+ sync::atomic::{AtomicI32, Or... | 1 | 20 | 30 |
ca22d0674ff68502cbaa1b8cdfc64d5da87b9230 | Linus Färnstrand | 2019-03-25T22:17:50 | Use cfg_if! macro for selecting thread_parker impl | diff --git a/core/Cargo.toml b/core/Cargo.toml
index c4027dd..6cd2a3e 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -10,6 +10,7 @@ categories = ["concurrency"]
edition = "2018"
[dependencies]
+cfg-if = "0.1"
smallvec = "0.6"
rand = "0.6"
petgraph = { version = "0.4.5", optional = true }
diff --git a/core... | 2 | 25 | 33 |
c89a085ab780b51dc7fbc3d7fb4b1d35438fd47b | Linus Färnstrand | 2019-03-22T18:42:09 | Add wasm ThreadParker | diff --git a/core/src/lib.rs b/core/src/lib.rs
index dfef9d7..1b6ec8d 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -43,6 +43,14 @@
all(target_env = "sgx", target_vendor = "fortanix"),
feature(sgx_platform)
)]
+#![cfg_attr(
+ all(
+ feature = "nightly",
+ target_arch = "wasm32",
+ ... | 2 | 144 | 1 |
8844366f696997ac1ff751822a499af8b169ea68 | Linus Färnstrand | 2019-03-20T18:06:54 | Only panic in send when debug_assertions are enabled | diff --git a/core/src/thread_parker/sgx.rs b/core/src/thread_parker/sgx.rs
index f18b862..c5ef6cb 100644
--- a/core/src/thread_parker/sgx.rs
+++ b/core/src/thread_parker/sgx.rs
@@ -89,9 +89,14 @@ impl UnparkHandle {
// released to avoid blocking the queue for too long.
#[inline]
pub fn unpark(self) {
- ... | 1 | 8 | 3 |
3996e3ed40bf600eb43e98d9e07c4f5f89567df2 | Linus Färnstrand | 2019-03-20T17:45:46 | Only panic in park when debug_assertions are enabled | diff --git a/core/src/thread_parker/sgx.rs b/core/src/thread_parker/sgx.rs
index 6d5d2e9..f18b862 100644
--- a/core/src/thread_parker/sgx.rs
+++ b/core/src/thread_parker/sgx.rs
@@ -54,8 +54,8 @@ impl ThreadParker {
#[inline]
pub fn park(&self) {
while self.parked.load(Ordering::Acquire) {
- ... | 1 | 2 | 2 |
9050a287d890b9597d49a23f787d1333ba4373b1 | Linus Färnstrand | 2019-03-20T17:25:33 | Only panic in send if error is not InvalidInput | diff --git a/core/src/thread_parker/sgx.rs b/core/src/thread_parker/sgx.rs
index 5c5bf33..6d5d2e9 100644
--- a/core/src/thread_parker/sgx.rs
+++ b/core/src/thread_parker/sgx.rs
@@ -7,6 +7,7 @@
use core::sync::atomic::{AtomicBool, Ordering};
use std::{
+ io,
os::fortanix_sgx::{
thread::current as cu... | 1 | 6 | 1 |
7ffd6b30c87e393f18c8c797befde1a39a4cef6c | Linus Färnstrand | 2019-03-18T20:43:21 | Don't use thread::sleep in tests on SGX | diff --git a/src/rwlock.rs b/src/rwlock.rs
index 03abe8b..38eec99 100644
--- a/src/rwlock.rs
+++ b/src/rwlock.rs
@@ -533,7 +533,15 @@ mod tests {
thread::spawn(move || {
let _lock = arc2.write();
});
- thread::sleep(Duration::from_millis(100));
+
+ if cfg!(not(all(target_env... | 1 | 9 | 1 |
ffc18697afaf1595df27277ba25bffc44d89ec15 | Linus Färnstrand | 2019-03-18T20:19:31 | Reverse SGX cfg check to solve experimental target_vendor | diff --git a/core/src/lib.rs b/core/src/lib.rs
index b8df7dc..dfef9d7 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -40,7 +40,7 @@
#![warn(missing_docs)]
#![warn(rust_2018_idioms)]
#![cfg_attr(
- all(target_vendor = "fortanix", target_env = "sgx"),
+ all(target_env = "sgx", target_vendor = "fortanix"),... | 1 | 3 | 3 |
b636cfcc4f7c8f02b74887c5aafcb79cc8f91102 | Linus Färnstrand | 2019-03-18T20:05:17 | Panic in park_until instead of using timestamps | diff --git a/core/src/thread_parker/sgx.rs b/core/src/thread_parker/sgx.rs
index 8bf9135..5c5bf33 100644
--- a/core/src/thread_parker/sgx.rs
+++ b/core/src/thread_parker/sgx.rs
@@ -5,7 +5,7 @@
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except accor... | 1 | 4 | 11 |
bc0de4a3baaa6be2d7911eb0a2ef0e77975f5376 | Linus Färnstrand | 2019-03-05T22:56:53 | Add SGX thread parker | diff --git a/core/src/lib.rs b/core/src/lib.rs
index d01846d..b8df7dc 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -39,17 +39,28 @@
#![warn(missing_docs)]
#![warn(rust_2018_idioms)]
+#![cfg_attr(
+ all(target_vendor = "fortanix", target_env = "sgx"),
+ feature(sgx_platform)
+)]
#[cfg(all(feature =... | 2 | 117 | 1 |
d88854de71cf6f19138b227c4650bec6073a2bae | Linus Färnstrand | 2019-03-04T21:31:15 | Remove stabilized attributes | diff --git a/core/src/lib.rs b/core/src/lib.rs
index 7188d79..d01846d 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -39,10 +39,6 @@
#![warn(missing_docs)]
#![warn(rust_2018_idioms)]
-#![cfg_attr(
- all(feature = "nightly", target_os = "linux"),
- feature(integer_atomics)
-)]
#[cfg(all(feature = "ni... | 2 | 0 | 7 |
a976430372a32b560888fa533549fb9614ba871a | Linus Färnstrand | 2019-03-04T18:15:04 | Enable 2018 edition idiom warnings | diff --git a/core/src/lib.rs b/core/src/lib.rs
index 3ae0ab4..7188d79 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -38,6 +38,7 @@
//! reference count and the two mutex bits in the same atomic word.
#![warn(missing_docs)]
+#![warn(rust_2018_idioms)]
#![cfg_attr(
all(feature = "nightly", target_os = "l... | 3 | 3 | 0 |
c45d4e9cbe65f27fa8a7940ef00d7b5b077c5fb6 | Linus Färnstrand | 2019-03-04T17:32:36 | Cleanup/restructure use statements | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index 791da99..d461fbd 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -8,12 +8,13 @@
use crate::thread_parker::ThreadParker;
use crate::util::UncheckedOptionExt;
use crate::word_lock::WordLock;
-use rand::rngs::SmallRng;
-use rand:... | 12 | 82 | 57 |
28bf1aae07e453fa9acd675a4a6e469b28df7ff8 | Linus Färnstrand | 2019-03-04T17:09:31 | Upgrade to Rust 2018 | diff --git a/Cargo.toml b/Cargo.toml
index bf0d820..1cce947 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,6 +8,7 @@ repository = "https://github.com/Amanieu/parking_lot"
readme = "README.md"
keywords = ["mutex", "condvar", "rwlock", "once", "thread"]
categories = ["concurrency"]
+edition = "2018"
[dependencies]
... | 21 | 127 | 143 |
0b6911698b02f4860dfe9af72cbdc06e6ab72018 | Linus Färnstrand | 2019-03-04T17:07:15 | Disable the owning_ref feature by default | diff --git a/Cargo.toml b/Cargo.toml
index 8351f86..bf0d820 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,7 +18,7 @@ rand = "0.6"
lazy_static = "1.0"
[features]
-default = ["owning_ref"]
+default = []
owning_ref = ["lock_api/owning_ref"]
nightly = ["parking_lot_core/nightly", "lock_api/nightly"]
deadlock_detec... | 1 | 1 | 1 |
533d20ee73487f9cecf8e40ff793672b587ded3a | Linus Färnstrand | 2019-03-04T17:01:34 | Remove support for <Rust 1.26 by assuming try_with | diff --git a/core/Cargo.toml b/core/Cargo.toml
index 69f084a..e489d9d 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -25,6 +25,3 @@ winapi = { version = "0.3", features = ["winnt", "ntstatus", "minwindef",
[features]
nightly = []
deadlock_detection = ["petgraph", "thread-id", "backtrace"]
-
-[build-dependenci... | 4 | 4 | 42 |
aa092c1aed371b01066803d2859fdad90506ea62 | Linus Färnstrand | 2019-03-04T16:57:03 | Remove < Rust 1.25 support by using repr(align) | diff --git a/core/build.rs b/core/build.rs
index 7cb883e..8d745ee 100644
--- a/core/build.rs
+++ b/core/build.rs
@@ -2,9 +2,6 @@ extern crate rustc_version;
use rustc_version::{version, Version};
fn main() {
- if version().unwrap() >= Version::parse("1.25.0").unwrap() {
- println!("cargo:rustc-cfg=has_rep... | 2 | 1 | 12 |
318d6f348d794863cc7cb6d7c66ff57805748809 | Amanieu d'Antras | 2019-02-02T16:18:42 | Implement Debug and Display on guards | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index 7e69c8b..b643dac 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -439,6 +439,18 @@ impl<'a, R: RawMutex + 'a, T: ?Sized + 'a> Drop for MutexGuard<'a, R, T> {
}
}
+impl<'a, R: RawMutex + 'a, T: fmt::Debug + ?Sized + 'a> fmt::Debug... | 3 | 134 | 0 |
e62e709472db8875a7dfd7565abfd670593ada73 | Amanieu d'Antras | 2019-02-02T16:18:28 | Add message on #[must_use] | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index 003b530..7e69c8b 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -292,7 +292,7 @@ impl<R: RawMutex, T: ?Sized + fmt::Debug> fmt::Debug for Mutex<R, T> {
///
/// The data protected by the mutex can be accessed through this guard via its... | 3 | 9 | 9 |
61f3ec3be7456e7f52b89c23bf112b1c0bc0eff6 | Amanieu d'Antras | 2019-02-02T16:17:52 | Update example in Mutex | diff --git a/src/mutex.rs b/src/mutex.rs
index 99498e1..0756c67 100644
--- a/src/mutex.rs
+++ b/src/mutex.rs
@@ -69,7 +69,7 @@ use raw_mutex::RawMutex;
///
/// let (tx, rx) = channel();
/// for _ in 0..10 {
-/// let (data, tx) = (data.clone(), tx.clone());
+/// let (data, tx) = (Arc::clone(&data), tx.clone()... | 1 | 1 | 1 |
293e7112909ebf5b1b8a415a26a58bb08964330a | Amanieu d'Antras | 2019-02-02T16:17:14 | Improve Debug for locked mutexes/rwlocks | diff --git a/lock_api/src/mutex.rs b/lock_api/src/mutex.rs
index 435cf2b..003b530 100644
--- a/lock_api/src/mutex.rs
+++ b/lock_api/src/mutex.rs
@@ -271,7 +271,18 @@ impl<R: RawMutex, T: ?Sized + fmt::Debug> fmt::Debug for Mutex<R, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self.try... | 5 | 38 | 5 |
9df9119889ad575adbb186efea80197477673aae | Amanieu d'Antras | 2019-01-03T19:03:35 | Make functions from parking_lot_core #[inline]
These are only ever called from #[inline(never)] functions, so there
shouldn't be too much code duplication. | diff --git a/core/src/parking_lot.rs b/core/src/parking_lot.rs
index 246b958..440dde0 100644
--- a/core/src/parking_lot.rs
+++ b/core/src/parking_lot.rs
@@ -38,6 +38,7 @@ struct HashTable {
}
impl HashTable {
+ #[inline]
fn new(num_threads: usize, prev: *const HashTable) -> Box<HashTable> {
let new... | 8 | 102 | 21 |
481fd42de52d39392eedcd503695279b8741aef0 | Amanieu d'Antras | 2019-01-30T17:52:44 | Update scopeguard dependency | diff --git a/lock_api/Cargo.toml b/lock_api/Cargo.toml
index d56978d..0b009d6 100644
--- a/lock_api/Cargo.toml
+++ b/lock_api/Cargo.toml
@@ -9,7 +9,7 @@ keywords = ["mutex", "rwlock", "lock", "no_std"]
categories = ["concurrency", "no-std"]
[dependencies]
-scopeguard = { version = "0.3", default-features = false }
... | 1 | 1 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.