Skip to content

Use the parking_lot locking primitives #56410

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

Closed
wants to merge 40 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
7b0ad27
Add parking_lot as submodule
faern Dec 14, 2018
1aab11d
Exclude parking_lot benchmark crate from root workspace
faern Mar 19, 2019
e313500
Add needed winapi bindings
faern Nov 26, 2018
20ab8d2
Use parking_lot::RawRwLock in panicking module
faern Feb 14, 2019
7cafa6d
Use parking_lot::RawRwLock to implement std::sync::RwLock
faern Feb 14, 2019
7c42fc8
Remove unused sys/sys_common::rwlock
faern Feb 20, 2019
3b23add
Use parking_lot::ReentrantMutex in stdio
faern Feb 19, 2019
f58fc9b
Use parking_lot::Mutex for stdin
faern Feb 20, 2019
81a1e21
Remove unused sys/sys_common ReentrantMutex
faern Feb 20, 2019
5a3dd8a
Base Mutex/Condvar on parking_lot primitives
faern Feb 20, 2019
d354b95
Remove unused sys/sys_common::condvar
faern Feb 20, 2019
8edc128
Remove Mutex init, try_lock, raw_unlock and destroy
faern Feb 27, 2019
4f0f8e1
Remove sys/sys_common::mutex::raw functions
faern Feb 27, 2019
a0b366c
Add sync::RawMutex
faern Mar 3, 2019
8dfad4b
Move io::lazy over to RawMutex
faern Mar 3, 2019
d6fab63
Move std::time over to RawMutex
faern Mar 3, 2019
fc379ee
Move at_exit over to RawMutex
faern Mar 3, 2019
142bda2
Move thread_local over to RawMutex
faern Mar 3, 2019
eaaca60
Move thread over to RawMutex
faern Mar 3, 2019
0d679ef
Move unix::args over to RawMutex
faern Mar 3, 2019
e8e355e
Move unix::os over to RawMutex
faern Mar 3, 2019
55f1ed2
Fix unix fork locking to work with parking_lot
faern Mar 3, 2019
c6c6fb1
Use RawMutex in backtrace
faern Feb 19, 2019
f1a805b
Remove unused sys/sys_common::mutex
faern Mar 3, 2019
0b1a6e9
Lock locks outside unsafe blocks
faern Feb 19, 2019
a562580
Use sys_common::mutex in sys::windows::process
faern Feb 21, 2019
b50a20e
Remove unused sys::c items from Windows
faern Feb 21, 2019
6ad5485
Remove unused sgx waitqueue types
faern Apr 1, 2019
0070390
Convert thread parking to use parking_lot primitives
faern Mar 2, 2019
c294204
Move redox::args over to RawMutex
faern Mar 4, 2019
c301ce0
Make redox::os use RawMutex
faern Mar 4, 2019
dd30a55
Remove wasi locking modules
faern Mar 31, 2019
e0fd309
Make cloudabi::abi module public inside libstd
faern Apr 1, 2019
0048440
Update SGX libunwind FFI interface to use new RwLock
faern Apr 1, 2019
e49bbd1
Make Lazy::get not unsafe any more
faern Apr 17, 2019
f40d609
Base Once on parking_lot::Once
faern Apr 18, 2019
56c2805
Add better documentation for RawMutex
faern Apr 20, 2019
7124cae
Improve Lazy documentation
faern Apr 20, 2019
6695be8
Base park/unpark directly on parking_lot_core
faern May 5, 2019
795285f
Fix park/unpark after feedback
faern May 12, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use parking_lot::Mutex for stdin
  • Loading branch information
faern committed May 4, 2019
commit f58fc9b8bdf1e51a5b3588644553306b2bcd41a7
6 changes: 3 additions & 3 deletions src/libstd/io/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ use crate::cell::RefCell;
use crate::fmt;
use crate::io::lazy::Lazy;
use crate::io::{self, Initializer, BufReader, LineWriter, IoSlice, IoSliceMut};
use crate::sync::{Arc, Mutex, MutexGuard};
use crate::sync::Arc;
use crate::sys::stdio;
use crate::panic::{UnwindSafe, RefUnwindSafe};
use crate::parking_lot::{ReentrantMutex, ReentrantMutexGuard};
use crate::parking_lot::{Mutex, MutexGuard, ReentrantMutex, ReentrantMutexGuard};
use crate::thread::LocalKey;

thread_local! {
Expand Down Expand Up @@ -286,7 +286,7 @@ impl Stdin {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn lock(&self) -> StdinLock<'_> {
StdinLock { inner: self.inner.lock().unwrap_or_else(|e| e.into_inner()) }
StdinLock { inner: self.inner.lock() }
}

/// Locks this handle and reads a line of input into the specified buffer.
Expand Down