-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't use parking_lot primitives in thread destructors (TLS variable's Drop
)
#37
Comments
TLS is mainly used for the |
Fixed in 0.4.5 |
Doesn't appear to be fixed:
|
Reproduction (through diff --git a/conc/Cargo.toml b/conc/Cargo.toml
index f541f3c..65bc2f2 100644
--- a/conc/Cargo.toml
+++ b/conc/Cargo.toml
@@ -12,7 +12,7 @@ exclude = ["target", "Cargo.lock"]
[dependencies]
lazy_static = "0.2"
rand = "0.3"
-spin = "0.4"
+parking_lot = "0.4"
[dependencies.backtrace]
version = "0.3"
diff --git a/conc/src/global.rs b/conc/src/global.rs
index 86b07d7..21d7da0 100644
--- a/conc/src/global.rs
+++ b/conc/src/global.rs
@@ -1,6 +1,6 @@
//! The global state.
-use spin::Mutex;
+use parking_lot::Mutex;
use std::collections::HashSet;
use std::{mem, panic};
use {rand, hazard, mpsc, debug, settings};
diff --git a/conc/src/lib.rs b/conc/src/lib.rs
index 2faf7c9..18e4d6a 100644
--- a/conc/src/lib.rs
+++ b/conc/src/lib.rs
@@ -150,7 +150,7 @@
#[macro_use]
extern crate lazy_static;
extern crate rand;
-extern crate spin;
+extern crate parking_lot;
mod atomic;
mod debug;
diff --git a/conc/src/mpsc.rs b/conc/src/mpsc.rs
index 1596836..7820864 100644
--- a/conc/src/mpsc.rs
+++ b/conc/src/mpsc.rs
@@ -8,7 +8,7 @@
//! although this is reasonably fast as the lock is only held for very short time, it is
//! sub-optimal, and blocking.
-use spin::Mutex;
+use parking_lot::Mutex;
use std::sync::Arc;
use std::mem; |
(just run test suite of |
Ah sorry, forgot to |
I still get a bunch of errors, albeit the tests runs:
|
I use |
Ah I see. |
It seems that
parking_lot
makes use of TLS vars, which subtly makes the primitives unusable in some cases of thread destructors, since the internal TLS variable has been dropped. Ideally, a secondary path should exist, taken if the TLS variable has been destroyed.The text was updated successfully, but these errors were encountered: