From 7b8af30590ebe7ae78e06c7bd6d70fb79d85cc43 Mon Sep 17 00:00:00 2001 From: Hawstein Date: Sun, 3 Sep 2017 02:09:13 +0800 Subject: [PATCH] remove re-export of parking_lot in util (#6435) --- Cargo.lock | 11 +++++++++++ Cargo.toml | 1 + dapps/Cargo.toml | 1 + dapps/src/apps/fetcher/mod.rs | 2 +- dapps/src/handlers/fetch.rs | 2 +- dapps/src/lib.rs | 3 ++- dapps/src/tests/helpers/fetch.rs | 2 +- dapps/src/tests/helpers/registrar.rs | 3 ++- ethcore/Cargo.toml | 1 + ethcore/evm/Cargo.toml | 1 + ethcore/evm/src/interpreter/shared_cache.rs | 3 ++- ethcore/evm/src/lib.rs | 1 + ethcore/light/Cargo.toml | 1 + ethcore/light/src/client/header_chain.rs | 6 +++--- ethcore/light/src/client/mod.rs | 3 ++- ethcore/light/src/client/service.rs | 6 +++--- ethcore/light/src/lib.rs | 1 + ethcore/light/src/net/load_timer.rs | 2 +- ethcore/light/src/net/mod.rs | 5 +++-- ethcore/light/src/net/tests/mod.rs | 2 +- ethcore/light/src/on_demand/mod.rs | 2 +- ethcore/light/src/on_demand/request.rs | 6 ++++-- ethcore/light/src/on_demand/tests.rs | 3 ++- ethcore/light/src/provider.rs | 3 ++- ethcore/node_filter/Cargo.toml | 1 + ethcore/node_filter/src/lib.rs | 4 +++- ethcore/src/account_provider/mod.rs | 2 +- ethcore/src/blockchain/blockchain.rs | 1 + ethcore/src/client/ancient_import.rs | 2 +- ethcore/src/client/client.rs | 3 ++- ethcore/src/client/test_client.rs | 1 + ethcore/src/db.rs | 3 ++- ethcore/src/engines/authority_round/mod.rs | 1 + ethcore/src/engines/basic_authority.rs | 1 + ethcore/src/engines/tendermint/mod.rs | 1 + ethcore/src/engines/validator_set/contract.rs | 1 + ethcore/src/engines/validator_set/multi.rs | 3 ++- ethcore/src/engines/validator_set/safe_contract.rs | 1 + ethcore/src/engines/vote_collector.rs | 1 + ethcore/src/lib.rs | 1 + ethcore/src/miner/external.rs | 3 ++- ethcore/src/miner/miner.rs | 1 + ethcore/src/miner/service_transaction_checker.rs | 3 ++- ethcore/src/miner/stratum.rs | 2 +- ethcore/src/miner/work_notify.rs | 1 + ethcore/src/snapshot/mod.rs | 2 +- ethcore/src/snapshot/service.rs | 3 ++- ethcore/src/snapshot/tests/proof_of_work.rs | 3 ++- ethcore/src/snapshot/tests/state.rs | 2 +- ethcore/src/snapshot/watcher.rs | 2 +- ethcore/src/spec/spec.rs | 1 + ethcore/src/state/backend.rs | 3 ++- ethcore/src/state_db.rs | 3 ++- ethcore/src/trace/db.rs | 3 ++- ethcore/src/verification/queue/mod.rs | 1 + hash-fetch/Cargo.toml | 1 + hash-fetch/src/client.rs | 2 +- hash-fetch/src/lib.rs | 1 + hash-fetch/src/urlhint.rs | 3 ++- parity/blockchain.rs | 3 ++- parity/informant.rs | 3 ++- parity/light_helpers/queue_cull.rs | 2 +- parity/main.rs | 1 + parity/rpc_apis.rs | 2 +- parity/run.rs | 7 ++++--- rpc/Cargo.toml | 1 + rpc/src/lib.rs | 1 + rpc/src/v1/helpers/dispatch.rs | 3 ++- rpc/src/v1/helpers/light_fetch.rs | 3 ++- rpc/src/v1/helpers/signer.rs | 2 +- rpc/src/v1/helpers/signing_queue.rs | 6 ++++-- rpc/src/v1/helpers/subscription_manager.rs | 2 +- rpc/src/v1/impls/eth.rs | 2 +- rpc/src/v1/impls/eth_filter.rs | 3 ++- rpc/src/v1/impls/eth_pubsub.rs | 3 ++- rpc/src/v1/impls/light/eth.rs | 3 ++- rpc/src/v1/impls/pubsub.rs | 2 +- rpc/src/v1/impls/signer.rs | 2 +- rpc/src/v1/impls/signing.rs | 3 ++- rpc/src/v1/informant.rs | 2 +- rpc/src/v1/tests/helpers/miner_service.rs | 3 ++- rpc/src/v1/tests/helpers/snapshot_service.rs | 3 ++- rpc/src/v1/tests/helpers/sync_provider.rs | 3 ++- rpc/src/v1/tests/mocked/eth.rs | 3 ++- rpc_client/Cargo.toml | 1 + rpc_client/src/client.rs | 2 +- rpc_client/src/lib.rs | 1 + stratum/Cargo.toml | 1 + stratum/src/lib.rs | 4 +++- sync/src/chain.rs | 4 +++- sync/src/light_sync/mod.rs | 3 ++- sync/src/light_sync/tests/test_net.rs | 2 +- sync/src/tests/helpers.rs | 1 + sync/src/tests/snapshot.rs | 1 + updater/Cargo.toml | 1 + updater/src/lib.rs | 1 + updater/src/updater.rs | 3 ++- util/network/src/tests.rs | 3 ++- util/src/lib.rs | 2 -- 99 files changed, 161 insertions(+), 75 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 207145a296e..b126d3d356c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -530,6 +530,7 @@ dependencies = [ "native-contracts 0.1.0", "num 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "price-info 1.7.0", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.0", @@ -662,6 +663,7 @@ dependencies = [ "heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.0", "rlp_derive 0.1.0", @@ -771,6 +773,7 @@ dependencies = [ "jsonrpc-tcp-server 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -937,6 +940,7 @@ dependencies = [ "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wasm 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.0", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "vm 0.1.0", @@ -1650,6 +1654,7 @@ dependencies = [ "futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "native-contracts 0.1.0", + "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1890,6 +1895,7 @@ dependencies = [ "parity-rpc-client 1.4.0", "parity-updater 1.8.0", "parity-whisper 0.1.0", + "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "path 0.1.0", "pretty_assertions 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1932,6 +1938,7 @@ dependencies = [ "parity-hash-fetch 1.8.0", "parity-reactor 0.1.0", "parity-ui 1.8.0", + "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1971,6 +1978,7 @@ dependencies = [ "mime_guess 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "native-contracts 0.1.0", "parity-reactor 0.1.0", + "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2049,6 +2057,7 @@ dependencies = [ "order-stat 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-reactor 0.1.0", "parity-updater 1.8.0", + "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.0", @@ -2077,6 +2086,7 @@ dependencies = [ "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-rpc 1.8.0", + "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2140,6 +2150,7 @@ dependencies = [ "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "parity-hash-fetch 1.8.0", "parity-reactor 0.1.0", + "parking_lot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "path 0.1.0", "target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/Cargo.toml b/Cargo.toml index 9f6dd9ccba7..8eb4acd28df 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,7 @@ number_prefix = "0.2" rpassword = "0.2.1" semver = "0.6" ansi_term = "0.9" +parking_lot = "0.4" regex = "0.2" isatty = "0.1" toml = "0.4" diff --git a/dapps/Cargo.toml b/dapps/Cargo.toml index 76b026c9a6c..35ec2d983f9 100644 --- a/dapps/Cargo.toml +++ b/dapps/Cargo.toml @@ -13,6 +13,7 @@ futures = "0.1" linked-hash-map = "0.3" log = "0.3" parity-dapps-glue = "1.7" +parking_lot = "0.4" mime = "0.2" mime_guess = "1.6.1" rand = "0.3" diff --git a/dapps/src/apps/fetcher/mod.rs b/dapps/src/apps/fetcher/mod.rs index 5b91da1a32d..fe529d77222 100644 --- a/dapps/src/apps/fetcher/mod.rs +++ b/dapps/src/apps/fetcher/mod.rs @@ -32,7 +32,7 @@ use hyper; use hyper::status::StatusCode; use {Embeddable, SyncStatus, random_filename}; -use util::Mutex; +use parking_lot::Mutex; use page::LocalPageEndpoint; use handlers::{ContentHandler, ContentFetcherHandler}; use endpoint::{Endpoint, EndpointPath, Handler}; diff --git a/dapps/src/handlers/fetch.rs b/dapps/src/handlers/fetch.rs index 7740247d95a..afe1f508393 100644 --- a/dapps/src/handlers/fetch.rs +++ b/dapps/src/handlers/fetch.rs @@ -23,7 +23,7 @@ use std::time::{Instant, Duration}; use fetch::{self, Fetch}; use futures::Future; use parity_reactor::Remote; -use util::Mutex; +use parking_lot::Mutex; use hyper::{server, Decoder, Encoder, Next, Method, Control}; use hyper::net::HttpStream; diff --git a/dapps/src/lib.rs b/dapps/src/lib.rs index f5670c959be..688f1c8aca1 100644 --- a/dapps/src/lib.rs +++ b/dapps/src/lib.rs @@ -24,6 +24,7 @@ extern crate futures; extern crate itertools; extern crate linked_hash_map; extern crate mime_guess; +extern crate parking_lot; extern crate rand; extern crate rustc_hex; extern crate serde; @@ -73,7 +74,7 @@ use std::collections::HashMap; use std::mem; use std::path::PathBuf; use std::sync::Arc; -use util::RwLock; +use parking_lot::RwLock; use jsonrpc_http_server::{self as http, hyper, Origin}; diff --git a/dapps/src/tests/helpers/fetch.rs b/dapps/src/tests/helpers/fetch.rs index e6e875c5144..853d6857e29 100644 --- a/dapps/src/tests/helpers/fetch.rs +++ b/dapps/src/tests/helpers/fetch.rs @@ -16,7 +16,7 @@ use std::{io, thread, time}; use std::sync::{atomic, mpsc, Arc}; -use util::Mutex; +use parking_lot::Mutex; use futures::{self, Future}; use fetch::{self, Fetch}; diff --git a/dapps/src/tests/helpers/registrar.rs b/dapps/src/tests/helpers/registrar.rs index d7890675b93..03fe3d5e480 100644 --- a/dapps/src/tests/helpers/registrar.rs +++ b/dapps/src/tests/helpers/registrar.rs @@ -20,7 +20,8 @@ use std::collections::HashMap; use rustc_hex::FromHex; use hash_fetch::urlhint::ContractClient; -use util::{Bytes, Address, Mutex, H256, ToPretty}; +use parking_lot::Mutex; +use util::{Bytes, Address, H256, ToPretty}; const REGISTRAR: &'static str = "8e4e9b13d4b45cb0befc93c3061b1408f67316b2"; const URLHINT: &'static str = "deadbeefcafe0000000000000000000000000000"; diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index 59e0b14d1d4..5b37d96ca54 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -46,6 +46,7 @@ lru-cache = "0.1.0" native-contracts = { path = "native_contracts" } num = "0.1" num_cpus = "1.2" +parking_lot = "0.4" price-info = { path = "../price-info" } rand = "0.3" rlp = { path = "../util/rlp" } diff --git a/ethcore/evm/Cargo.toml b/ethcore/evm/Cargo.toml index 7d323d6224a..e6b72e68aa3 100644 --- a/ethcore/evm/Cargo.toml +++ b/ethcore/evm/Cargo.toml @@ -16,6 +16,7 @@ log = "0.3" rlp = { path = "../../util/rlp" } vm = { path = "../vm" } parity-wasm = "0.12" +parking_lot = "0.4" ethcore-logger = { path = "../../logger" } wasm-utils = { git = "https://github.com/paritytech/wasm-utils" } hash = { path = "../../util/hash" } diff --git a/ethcore/evm/src/interpreter/shared_cache.rs b/ethcore/evm/src/interpreter/shared_cache.rs index 4f70044dd1c..ed39d30c874 100644 --- a/ethcore/evm/src/interpreter/shared_cache.rs +++ b/ethcore/evm/src/interpreter/shared_cache.rs @@ -17,7 +17,8 @@ use std::sync::Arc; use hash::KECCAK_EMPTY; use heapsize::HeapSizeOf; -use util::{H256, Mutex}; +use parking_lot::Mutex; +use util::H256; use util::cache::MemoryLruCache; use bit_set::BitSet; use super::super::instructions; diff --git a/ethcore/evm/src/lib.rs b/ethcore/evm/src/lib.rs index d5b08c8d8a9..4b418fd7405 100644 --- a/ethcore/evm/src/lib.rs +++ b/ethcore/evm/src/lib.rs @@ -23,6 +23,7 @@ extern crate ethcore_util as util; extern crate ethjson; extern crate rlp; extern crate parity_wasm; +extern crate parking_lot; extern crate wasm_utils; extern crate ethcore_logger; extern crate heapsize; diff --git a/ethcore/light/Cargo.toml b/ethcore/light/Cargo.toml index 4e7b3523ddb..46ae3afe05e 100644 --- a/ethcore/light/Cargo.toml +++ b/ethcore/light/Cargo.toml @@ -31,6 +31,7 @@ itertools = "0.5" bincode = "0.8.0" serde = "1.0" serde_derive = "1.0" +parking_lot = "0.4" stats = { path = "../../util/stats" } hash = { path = "../../util/hash" } diff --git a/ethcore/light/src/client/header_chain.rs b/ethcore/light/src/client/header_chain.rs index a16cb0c852f..85f8123c47b 100644 --- a/ethcore/light/src/client/header_chain.rs +++ b/ethcore/light/src/client/header_chain.rs @@ -37,11 +37,11 @@ use ethcore::ids::BlockId; use rlp::{Encodable, Decodable, DecoderError, RlpStream, Rlp, UntrustedRlp}; use heapsize::HeapSizeOf; -use util::{H256, U256, RwLock}; +use util::{H256, U256}; use util::kvdb::{DBTransaction, KeyValueDB}; use cache::Cache; -use util::Mutex; +use parking_lot::{Mutex, RwLock}; use smallvec::SmallVec; @@ -555,7 +555,7 @@ mod tests { use cache::Cache; use time::Duration; - use util::Mutex; + use parking_lot::Mutex; fn make_db() -> Arc<::util::KeyValueDB> { Arc::new(::util::kvdb::in_memory(0)) diff --git a/ethcore/light/src/client/mod.rs b/ethcore/light/src/client/mod.rs index ee270c97741..387abc8ad92 100644 --- a/ethcore/light/src/client/mod.rs +++ b/ethcore/light/src/client/mod.rs @@ -30,8 +30,9 @@ use ethcore::spec::Spec; use ethcore::service::ClientIoMessage; use ethcore::encoded; use io::IoChannel; +use parking_lot::{Mutex, RwLock}; -use util::{H256, U256, Mutex, RwLock}; +use util::{H256, U256}; use util::kvdb::{KeyValueDB, CompactionProfile}; use self::header_chain::{AncestryIter, HeaderChain}; diff --git a/ethcore/light/src/client/service.rs b/ethcore/light/src/client/service.rs index 83949a2f18e..99dccc99917 100644 --- a/ethcore/light/src/client/service.rs +++ b/ethcore/light/src/client/service.rs @@ -28,7 +28,7 @@ use io::{IoContext, IoError, IoHandler, IoService}; use util::kvdb::{Database, DatabaseConfig}; use cache::Cache; -use util::Mutex; +use parking_lot::Mutex; use super::{Client, Config as ClientConfig}; @@ -117,11 +117,11 @@ mod tests { use super::Service; use devtools::RandomTempPath; use ethcore::spec::Spec; - + use std::sync::Arc; use cache::Cache; use time::Duration; - use util::Mutex; + use parking_lot::Mutex; #[test] fn it_works() { diff --git a/ethcore/light/src/lib.rs b/ethcore/light/src/lib.rs index 37de032057f..5d9a5ae32b4 100644 --- a/ethcore/light/src/lib.rs +++ b/ethcore/light/src/lib.rs @@ -77,6 +77,7 @@ extern crate futures; extern crate itertools; extern crate rand; extern crate rlp; +extern crate parking_lot; #[macro_use] extern crate rlp_derive; extern crate serde; diff --git a/ethcore/light/src/net/load_timer.rs b/ethcore/light/src/net/load_timer.rs index a169b86d96f..7b78fc693ea 100644 --- a/ethcore/light/src/net/load_timer.rs +++ b/ethcore/light/src/net/load_timer.rs @@ -32,7 +32,7 @@ use request::{CompleteRequest, Kind}; use bincode; use time; -use util::{RwLock, Mutex}; +use parking_lot::{RwLock, Mutex}; /// Number of time periods samples should be kept for. pub const MOVING_SAMPLE_SIZE: usize = 256; diff --git a/ethcore/light/src/net/mod.rs b/ethcore/light/src/net/mod.rs index 046dc68bd09..9f47c56ffae 100644 --- a/ethcore/light/src/net/mod.rs +++ b/ethcore/light/src/net/mod.rs @@ -24,7 +24,8 @@ use io::TimerToken; use network::{HostInfo, NetworkProtocolHandler, NetworkContext, PeerId}; use rlp::{RlpStream, UntrustedRlp}; use util::hash::H256; -use util::{DBValue, Mutex, RwLock, U256}; +use util::{DBValue, U256}; +use parking_lot::{Mutex, RwLock}; use time::{Duration, SteadyTime}; use std::collections::{HashMap, HashSet}; @@ -287,7 +288,7 @@ pub type PeerMap = HashMap>; mod id_guard { use network::PeerId; - use util::RwLockReadGuard; + use parking_lot::RwLockReadGuard; use super::{PeerMap, ReqId}; diff --git a/ethcore/light/src/net/tests/mod.rs b/ethcore/light/src/net/tests/mod.rs index ef86c08f56a..15a5eb21a9e 100644 --- a/ethcore/light/src/net/tests/mod.rs +++ b/ethcore/light/src/net/tests/mod.rs @@ -606,7 +606,7 @@ fn id_guard() { pending_requests.insert(req_id_1, req.clone(), 0.into(), ::time::SteadyTime::now()); pending_requests.insert(req_id_2, req, 1.into(), ::time::SteadyTime::now()); - proto.peers.write().insert(peer_id, ::util::Mutex::new(Peer { + proto.peers.write().insert(peer_id, ::parking_lot::Mutex::new(Peer { local_credits: flow_params.create_credits(), status: status(provider.client.chain_info()), capabilities: capabilities.clone(), diff --git a/ethcore/light/src/on_demand/mod.rs b/ethcore/light/src/on_demand/mod.rs index 42469725bbf..d67b7dc4e37 100644 --- a/ethcore/light/src/on_demand/mod.rs +++ b/ethcore/light/src/on_demand/mod.rs @@ -27,7 +27,7 @@ use ethcore::executed::{Executed, ExecutionError}; use futures::{Async, Poll, Future}; use futures::sync::oneshot::{self, Sender, Receiver, Canceled}; use network::PeerId; -use util::{RwLock, Mutex}; +use parking_lot::{RwLock, Mutex}; use net::{ self, Handler, PeerStatus, Status, Capabilities, diff --git a/ethcore/light/src/on_demand/request.rs b/ethcore/light/src/on_demand/request.rs index 8ee41437bed..3a38ec974e6 100644 --- a/ethcore/light/src/on_demand/request.rs +++ b/ethcore/light/src/on_demand/request.rs @@ -30,7 +30,8 @@ use hash::{KECCAK_NULL_RLP, KECCAK_EMPTY, KECCAK_EMPTY_LIST_RLP, keccak}; use request::{self as net_request, IncompleteRequest, CompleteRequest, Output, OutputKind, Field}; use rlp::{RlpStream, UntrustedRlp}; -use util::{Address, Bytes, DBValue, HashDB, Mutex, H256, U256}; +use parking_lot::Mutex; +use util::{Address, Bytes, DBValue, HashDB, H256, U256}; use util::memorydb::MemoryDB; use util::trie::{Trie, TrieDB, TrieError}; @@ -850,7 +851,8 @@ impl TransactionProof { #[cfg(test)] mod tests { use super::*; - use util::{MemoryDB, Address, Mutex, H256}; + use parking_lot::Mutex; + use util::{MemoryDB, Address, H256}; use util::trie::{Trie, TrieMut, SecTrieDB, SecTrieDBMut}; use util::trie::recorder::Recorder; use hash::keccak; diff --git a/ethcore/light/src/on_demand/tests.rs b/ethcore/light/src/on_demand/tests.rs index 10c4ceae5f1..52d2bc5ea21 100644 --- a/ethcore/light/src/on_demand/tests.rs +++ b/ethcore/light/src/on_demand/tests.rs @@ -22,7 +22,8 @@ use ethcore::header::{Header, Seal}; use futures::Future; use network::{PeerId, NodeId}; use net::*; -use util::{H256, Mutex}; +use parking_lot::Mutex; +use util::H256; use time::Duration; use ::request::{self as basic_request, Response}; diff --git a/ethcore/light/src/provider.rs b/ethcore/light/src/provider.rs index 3632783caa9..8fc4c93e86b 100644 --- a/ethcore/light/src/provider.rs +++ b/ethcore/light/src/provider.rs @@ -24,7 +24,8 @@ use ethcore::client::{BlockChainClient, ProvingBlockChainClient}; use ethcore::transaction::PendingTransaction; use ethcore::ids::BlockId; use ethcore::encoded; -use util::{RwLock, H256}; +use parking_lot::RwLock; +use util::H256; use cht::{self, BlockInfo}; use client::{LightChainClient, AsLightClient}; diff --git a/ethcore/node_filter/Cargo.toml b/ethcore/node_filter/Cargo.toml index e885ef1d105..3abf86205c7 100644 --- a/ethcore/node_filter/Cargo.toml +++ b/ethcore/node_filter/Cargo.toml @@ -14,3 +14,4 @@ ethcore-network = { path = "../../util/network" } native-contracts = { path = "../native_contracts" } futures = "0.1" log = "0.3" +parking_lot = "0.4" diff --git a/ethcore/node_filter/src/lib.rs b/ethcore/node_filter/src/lib.rs index d3dcbaa3be0..b5ed94bb985 100644 --- a/ethcore/node_filter/src/lib.rs +++ b/ethcore/node_filter/src/lib.rs @@ -21,6 +21,7 @@ extern crate ethcore_util as util; extern crate ethcore_network as network; extern crate native_contracts; extern crate futures; +extern crate parking_lot; #[cfg(test)] extern crate ethcore_io as io; #[macro_use] extern crate log; @@ -29,7 +30,8 @@ use std::collections::HashMap; use native_contracts::PeerSet as Contract; use network::{NodeId, ConnectionFilter, ConnectionDirection}; use ethcore::client::{BlockChainClient, BlockId, ChainNotify}; -use util::{Mutex, Address, H256, Bytes}; +use util::{Address, H256, Bytes}; +use parking_lot::Mutex; use futures::Future; const MAX_CACHE_SIZE: usize = 4096; diff --git a/ethcore/src/account_provider/mod.rs b/ethcore/src/account_provider/mod.rs index 752cec9649f..6f8eab7b7c8 100755 --- a/ethcore/src/account_provider/mod.rs +++ b/ethcore/src/account_provider/mod.rs @@ -23,7 +23,7 @@ use self::stores::{AddressBook, DappsSettingsStore, NewDappsPolicy}; use std::fmt; use std::collections::{HashMap, HashSet}; use std::time::{Instant, Duration}; -use util::{RwLock}; +use parking_lot::RwLock; use ethstore::{ SimpleSecretStore, SecretStore, Error as SSError, EthStore, EthMultiStore, random_string, SecretVaultRef, StoreAccountRef, OpaqueSecret, diff --git a/ethcore/src/blockchain/blockchain.rs b/ethcore/src/blockchain/blockchain.rs index ac51a789e28..c4b39d1804a 100644 --- a/ethcore/src/blockchain/blockchain.rs +++ b/ethcore/src/blockchain/blockchain.rs @@ -22,6 +22,7 @@ use std::mem; use itertools::Itertools; use bloomchain as bc; use heapsize::HeapSizeOf; +use parking_lot::{Mutex, RwLock}; use util::*; use rlp::*; use header::*; diff --git a/ethcore/src/client/ancient_import.rs b/ethcore/src/client/ancient_import.rs index d4d8696d250..aaf24cdc176 100644 --- a/ethcore/src/client/ancient_import.rs +++ b/ethcore/src/client/ancient_import.rs @@ -23,7 +23,7 @@ use engines::{Engine, EpochVerifier}; use header::Header; use rand::Rng; -use util::RwLock; +use parking_lot::RwLock; // do "heavy" verification on ~1/50 blocks, randomly sampled. const HEAVY_VERIFY_RATE: f32 = 0.02; diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 69674901f6a..3ad909ae1b6 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -25,7 +25,7 @@ use itertools::Itertools; // util use hash::keccak; use timer::PerfTimer; -use util::{Bytes, Mutex, RwLock, MutexGuard}; +use util::Bytes; use util::{journaldb, DBValue, TrieFactory, Trie}; use util::{U256, H256, Address, H2048}; use util::trie::TrieSpec; @@ -56,6 +56,7 @@ use io::*; use log_entry::LocalizedLogEntry; use miner::{Miner, MinerService, TransactionImportResult}; use native_contracts::Registry; +use parking_lot::{Mutex, RwLock, MutexGuard}; use rand::OsRng; use receipt::{Receipt, LocalizedReceipt}; use rlp::UntrustedRlp; diff --git a/ethcore/src/client/test_client.rs b/ethcore/src/client/test_client.rs index 256d7953ddd..94e40e975db 100644 --- a/ethcore/src/client/test_client.rs +++ b/ethcore/src/client/test_client.rs @@ -23,6 +23,7 @@ use std::mem; use itertools::Itertools; use rustc_hex::FromHex; use hash::keccak; +use parking_lot::RwLock; use util::*; use rlp::*; use ethkey::{Generator, Random}; diff --git a/ethcore/src/db.rs b/ethcore/src/db.rs index bccb8e943b1..e60b77b2e09 100644 --- a/ethcore/src/db.rs +++ b/ethcore/src/db.rs @@ -19,7 +19,8 @@ use std::ops::Deref; use std::hash::Hash; use std::collections::HashMap; -use util::{DBTransaction, KeyValueDB, RwLock}; +use parking_lot::RwLock; +use util::{DBTransaction, KeyValueDB}; use rlp; diff --git a/ethcore/src/engines/authority_round/mod.rs b/ethcore/src/engines/authority_round/mod.rs index c9c48377337..8868a065791 100644 --- a/ethcore/src/engines/authority_round/mod.rs +++ b/ethcore/src/engines/authority_round/mod.rs @@ -43,6 +43,7 @@ use io::{IoContext, IoHandler, TimerToken, IoService}; use itertools::{self, Itertools}; use rlp::{UntrustedRlp, encode}; use semantic_version::SemanticVersion; +use parking_lot::{Mutex, RwLock}; use util::*; mod finality; diff --git a/ethcore/src/engines/basic_authority.rs b/ethcore/src/engines/basic_authority.rs index ccd69b38683..7847f0432d2 100644 --- a/ethcore/src/engines/basic_authority.rs +++ b/ethcore/src/engines/basic_authority.rs @@ -19,6 +19,7 @@ use std::sync::{Weak, Arc}; use std::collections::BTreeMap; use std::cmp; +use parking_lot::RwLock; use util::*; use ethkey::{recover, public_to_address, Signature}; use account_provider::AccountProvider; diff --git a/ethcore/src/engines/tendermint/mod.rs b/ethcore/src/engines/tendermint/mod.rs index f4b1422d86f..71f5565e9cd 100644 --- a/ethcore/src/engines/tendermint/mod.rs +++ b/ethcore/src/engines/tendermint/mod.rs @@ -30,6 +30,7 @@ use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering}; use std::collections::{HashSet, BTreeMap, HashMap}; use hash::keccak; use std::cmp; +use parking_lot::RwLock; use util::*; use client::{Client, EngineClient}; use error::{Error, BlockError}; diff --git a/ethcore/src/engines/validator_set/contract.rs b/ethcore/src/engines/validator_set/contract.rs index ff16eb1d22f..28414be0f59 100644 --- a/ethcore/src/engines/validator_set/contract.rs +++ b/ethcore/src/engines/validator_set/contract.rs @@ -18,6 +18,7 @@ /// It can also report validators for misbehaviour with two levels: `reportMalicious` and `reportBenign`. use std::sync::Weak; +use parking_lot::RwLock; use util::*; use futures::Future; diff --git a/ethcore/src/engines/validator_set/multi.rs b/ethcore/src/engines/validator_set/multi.rs index 477a453b251..53617094afd 100644 --- a/ethcore/src/engines/validator_set/multi.rs +++ b/ethcore/src/engines/validator_set/multi.rs @@ -19,7 +19,8 @@ use std::collections::BTreeMap; use std::sync::Weak; use engines::{Call, Engine}; -use util::{Bytes, H256, Address, RwLock}; +use parking_lot::RwLock; +use util::{Bytes, H256, Address}; use ids::BlockId; use header::{BlockNumber, Header}; use client::{Client, BlockChainClient}; diff --git a/ethcore/src/engines/validator_set/safe_contract.rs b/ethcore/src/engines/validator_set/safe_contract.rs index 6480a298e57..dc186818a0b 100644 --- a/ethcore/src/engines/validator_set/safe_contract.rs +++ b/ethcore/src/engines/validator_set/safe_contract.rs @@ -21,6 +21,7 @@ use futures::Future; use native_contracts::ValidatorSet as Provider; use hash::keccak; +use parking_lot::RwLock; use util::*; use util::cache::MemoryLruCache; use rlp::{UntrustedRlp, RlpStream}; diff --git a/ethcore/src/engines/vote_collector.rs b/ethcore/src/engines/vote_collector.rs index 387715a0305..8dd9f7c3646 100644 --- a/ethcore/src/engines/vote_collector.rs +++ b/ethcore/src/engines/vote_collector.rs @@ -19,6 +19,7 @@ use std::fmt::Debug; use std::collections::{BTreeMap, HashSet, HashMap}; use std::hash::Hash; +use parking_lot:: RwLock; use util::*; use rlp::{Encodable, RlpStream}; diff --git a/ethcore/src/lib.rs b/ethcore/src/lib.rs index df7c25d3f93..7d175ad7a8d 100644 --- a/ethcore/src/lib.rs +++ b/ethcore/src/lib.rs @@ -98,6 +98,7 @@ extern crate lru_cache; extern crate native_contracts; extern crate num_cpus; extern crate num; +extern crate parking_lot; extern crate price_info; extern crate rand; extern crate rlp; diff --git a/ethcore/src/miner/external.rs b/ethcore/src/miner/external.rs index 65f8ee8cc6f..c38bb16d43d 100644 --- a/ethcore/src/miner/external.rs +++ b/ethcore/src/miner/external.rs @@ -17,7 +17,8 @@ use std::collections::HashMap; use std::sync::Arc; use std::time::{Instant, Duration}; -use util::{Mutex, U256, H256}; +use util::{U256, H256}; +use parking_lot::Mutex; /// External miner interface. pub trait ExternalMinerService: Send + Sync { diff --git a/ethcore/src/miner/miner.rs b/ethcore/src/miner/miner.rs index fb1753760cd..6f5e5f23ca8 100644 --- a/ethcore/src/miner/miner.rs +++ b/ethcore/src/miner/miner.rs @@ -18,6 +18,7 @@ use std::time::{Instant, Duration}; use std::collections::{BTreeMap, HashSet}; use std::sync::Arc; +use parking_lot::{Mutex, RwLock}; use util::*; use timer::PerfTimer; use using_queue::{UsingQueue, GetAction}; diff --git a/ethcore/src/miner/service_transaction_checker.rs b/ethcore/src/miner/service_transaction_checker.rs index d21643772ac..a78f2a2c7a7 100644 --- a/ethcore/src/miner/service_transaction_checker.rs +++ b/ethcore/src/miner/service_transaction_checker.rs @@ -20,7 +20,8 @@ use types::ids::BlockId; use futures::{future, Future}; use native_contracts::ServiceTransactionChecker as Contract; -use util::{U256, Mutex}; +use parking_lot::Mutex; +use util::U256; const SERVICE_TRANSACTION_CONTRACT_REGISTRY_NAME: &'static str = "service_transaction_checker"; diff --git a/ethcore/src/miner/stratum.rs b/ethcore/src/miner/stratum.rs index 0031bb715d8..1586dc69fff 100644 --- a/ethcore/src/miner/stratum.rs +++ b/ethcore/src/miner/stratum.rs @@ -28,7 +28,7 @@ use std::fmt; use util::{H256, U256, H64, clean_0x}; use ethereum::ethash::Ethash; use ethash::SeedHashCompute; -use util::Mutex; +use parking_lot::Mutex; use miner::{self, Miner, MinerService}; use client::Client; use block::IsBlock; diff --git a/ethcore/src/miner/work_notify.rs b/ethcore/src/miner/work_notify.rs index ff330d30ca3..160aa1f46c1 100644 --- a/ethcore/src/miner/work_notify.rs +++ b/ethcore/src/miner/work_notify.rs @@ -24,6 +24,7 @@ use hyper::{Next}; use hyper::net::HttpStream; use ethash::SeedHashCompute; use hyper::Url; +use parking_lot::Mutex; use util::*; use ethereum::ethash::Ethash; diff --git a/ethcore/src/snapshot/mod.rs b/ethcore/src/snapshot/mod.rs index 974b074cffa..fa6ab8f0612 100644 --- a/ethcore/src/snapshot/mod.rs +++ b/ethcore/src/snapshot/mod.rs @@ -31,7 +31,7 @@ use header::Header; use ids::BlockId; use util::{Bytes, HashDB, DBValue, snappy, U256}; -use util::Mutex; +use parking_lot::Mutex; use util::hash::{H256}; use util::journaldb::{self, Algorithm, JournalDB}; use util::kvdb::KeyValueDB; diff --git a/ethcore/src/snapshot/service.rs b/ethcore/src/snapshot/service.rs index 47bbb59975d..24ce91d3919 100644 --- a/ethcore/src/snapshot/service.rs +++ b/ethcore/src/snapshot/service.rs @@ -35,7 +35,8 @@ use service::ClientIoMessage; use io::IoChannel; -use util::{Bytes, H256, Mutex, RwLock, RwLockReadGuard, UtilError}; +use parking_lot::{Mutex, RwLock, RwLockReadGuard}; +use util::{Bytes, H256, UtilError}; use util::journaldb::Algorithm; use util::kvdb::{Database, DatabaseConfig}; use util::snappy; diff --git a/ethcore/src/snapshot/tests/proof_of_work.rs b/ethcore/src/snapshot/tests/proof_of_work.rs index 907fcead8f3..428023a5c49 100644 --- a/ethcore/src/snapshot/tests/proof_of_work.rs +++ b/ethcore/src/snapshot/tests/proof_of_work.rs @@ -24,7 +24,8 @@ use blockchain::BlockChain; use snapshot::{chunk_secondary, Error as SnapshotError, Progress, SnapshotComponents}; use snapshot::io::{PackedReader, PackedWriter, SnapshotReader, SnapshotWriter}; -use util::{Mutex, snappy}; +use parking_lot::Mutex; +use util::snappy; use util::kvdb::{self, KeyValueDB, DBTransaction}; use std::sync::Arc; diff --git a/ethcore/src/snapshot/tests/state.rs b/ethcore/src/snapshot/tests/state.rs index 9a98af5ffd9..4e2e70a6f44 100644 --- a/ethcore/src/snapshot/tests/state.rs +++ b/ethcore/src/snapshot/tests/state.rs @@ -29,7 +29,7 @@ use util::hash::H256; use util::journaldb::{self, Algorithm}; use util::kvdb::{Database, DatabaseConfig}; use util::memorydb::MemoryDB; -use util::Mutex; +use parking_lot::Mutex; use devtools::RandomTempPath; use std::sync::Arc; diff --git a/ethcore/src/snapshot/watcher.rs b/ethcore/src/snapshot/watcher.rs index cff9be18cdc..89f8b62dfa1 100644 --- a/ethcore/src/snapshot/watcher.rs +++ b/ethcore/src/snapshot/watcher.rs @@ -16,7 +16,7 @@ //! Watcher for snapshot-related chain events. -use util::Mutex; +use parking_lot::Mutex; use client::{BlockChainClient, Client, ChainNotify}; use ids::BlockId; use service::ClientIoMessage; diff --git a/ethcore/src/spec/spec.rs b/ethcore/src/spec/spec.rs index e93703871b6..98f04da6fd2 100644 --- a/ethcore/src/spec/spec.rs +++ b/ethcore/src/spec/spec.rs @@ -40,6 +40,7 @@ use state_db::StateDB; use state::{Backend, State, Substate}; use state::backend::Basic as BasicBackend; use trace::{NoopTracer, NoopVMTracer}; +use parking_lot::RwLock; use util::*; /// Parameters common to ethereum-like blockchains. diff --git a/ethcore/src/state/backend.rs b/ethcore/src/state/backend.rs index ea172b5afef..ffe63f42387 100644 --- a/ethcore/src/state/backend.rs +++ b/ethcore/src/state/backend.rs @@ -25,7 +25,8 @@ use std::collections::{HashSet, HashMap}; use std::sync::Arc; use state::Account; -use util::{Address, MemoryDB, Mutex, H256}; +use parking_lot::Mutex; +use util::{Address, MemoryDB, H256}; use util::hashdb::{AsHashDB, HashDB, DBValue}; /// State backend. See module docs for more details. diff --git a/ethcore/src/state_db.rs b/ethcore/src/state_db.rs index ce96dc4fc28..dbba011250f 100644 --- a/ethcore/src/state_db.rs +++ b/ethcore/src/state_db.rs @@ -25,7 +25,8 @@ use util::hashdb::HashDB; use state::{self, Account}; use header::BlockNumber; use hash::keccak; -use util::{Address, DBTransaction, UtilError, Mutex}; +use parking_lot::Mutex; +use util::{Address, DBTransaction, UtilError}; use bloom_journal::{Bloom, BloomJournal}; use db::COL_ACCOUNT_BLOOM; use byteorder::{LittleEndian, ByteOrder}; diff --git a/ethcore/src/trace/db.rs b/ethcore/src/trace/db.rs index 0fe057a6448..d7055a54755 100644 --- a/ethcore/src/trace/db.rs +++ b/ethcore/src/trace/db.rs @@ -21,7 +21,8 @@ use std::sync::Arc; use bloomchain::{Number, Config as BloomConfig}; use bloomchain::group::{BloomGroupDatabase, BloomGroupChain, GroupPosition, BloomGroup}; use heapsize::HeapSizeOf; -use util::{H256, H264, KeyValueDB, DBTransaction, RwLock}; +use parking_lot::RwLock; +use util::{H256, H264, KeyValueDB, DBTransaction}; use header::BlockNumber; use trace::{LocalizedTrace, Config, Filter, Database as TraceDatabase, ImportRequest, DatabaseExtras}; use db::{self, Key, Writable, Readable, CacheUpdatePolicy}; diff --git a/ethcore/src/verification/queue/mod.rs b/ethcore/src/verification/queue/mod.rs index 8fc4a5919a3..ab019a21624 100644 --- a/ethcore/src/verification/queue/mod.rs +++ b/ethcore/src/verification/queue/mod.rs @@ -23,6 +23,7 @@ use std::sync::{Condvar as SCondvar, Mutex as SMutex, Arc}; use std::cmp; use std::collections::{VecDeque, HashSet, HashMap}; use heapsize::HeapSizeOf; +use parking_lot::{Condvar, Mutex, RwLock}; use util::*; use io::*; use error::*; diff --git a/hash-fetch/Cargo.toml b/hash-fetch/Cargo.toml index e87ffea1a84..884729a69e7 100644 --- a/hash-fetch/Cargo.toml +++ b/hash-fetch/Cargo.toml @@ -14,6 +14,7 @@ mime = "0.2" mime_guess = "1.6.1" rand = "0.3" rustc-hex = "1.0" +parking_lot = "0.4" fetch = { path = "../util/fetch" } ethcore-util = { path = "../util" } parity-reactor = { path = "../util/reactor" } diff --git a/hash-fetch/src/client.rs b/hash-fetch/src/client.rs index d63df794a24..6ebfdcb5cac 100644 --- a/hash-fetch/src/client.rs +++ b/hash-fetch/src/client.rs @@ -191,7 +191,7 @@ fn random_temp_path() -> PathBuf { mod tests { use rustc_hex::FromHex; use std::sync::{Arc, mpsc}; - use util::Mutex; + use parking_lot::Mutex; use futures::future; use fetch::{self, Fetch}; use parity_reactor::Remote; diff --git a/hash-fetch/src/lib.rs b/hash-fetch/src/lib.rs index 98777025263..c09af0c89ac 100644 --- a/hash-fetch/src/lib.rs +++ b/hash-fetch/src/lib.rs @@ -29,6 +29,7 @@ extern crate futures; extern crate mime_guess; extern crate native_contracts; extern crate parity_reactor; +extern crate parking_lot; extern crate rand; extern crate rustc_hex; extern crate hash; diff --git a/hash-fetch/src/urlhint.rs b/hash-fetch/src/urlhint.rs index 3fa32eb1574..945d20d72bf 100644 --- a/hash-fetch/src/urlhint.rs +++ b/hash-fetch/src/urlhint.rs @@ -216,7 +216,8 @@ pub mod tests { use super::*; use super::guess_mime_type; - use util::{Bytes, Address, Mutex, ToPretty}; + use parking_lot::Mutex; + use util::{Bytes, Address, ToPretty}; pub struct FakeRegistrar { pub calls: Arc>>, diff --git a/parity/blockchain.rs b/parity/blockchain.rs index a94b387d4a6..266be7dfd1e 100644 --- a/parity/blockchain.rs +++ b/parity/blockchain.rs @@ -155,6 +155,7 @@ pub fn execute(cmd: BlockchainCmd) -> Result<(), String> { fn execute_import_light(cmd: ImportBlockchain) -> Result<(), String> { use light::client::{Service as LightClientService, Config as LightClientConfig}; use light::cache::Cache as LightDataCache; + use parking_lot::Mutex; let timer = Instant::now(); @@ -188,7 +189,7 @@ fn execute_import_light(cmd: ImportBlockchain) -> Result<(), String> { // create dirs used by parity cmd.dirs.create_dirs(false, false, false)?; - let cache = Arc::new(::util::Mutex::new( + let cache = Arc::new(Mutex::new( LightDataCache::new(Default::default(), ::time::Duration::seconds(0)) )); diff --git a/parity/informant.rs b/parity/informant.rs index 4e29878925c..166e36a6288 100644 --- a/parity/informant.rs +++ b/parity/informant.rs @@ -35,7 +35,8 @@ use light::client::LightChainClient; use number_prefix::{binary_prefix, Standalone, Prefixed}; use parity_rpc::{is_major_importing}; use parity_rpc::informant::RpcStats; -use util::{RwLock, Mutex, H256, Bytes}; +use parking_lot::{RwLock, Mutex}; +use util::{H256, Bytes}; /// Format byte counts to standard denominations. pub fn format_bytes(b: usize) -> String { diff --git a/parity/light_helpers/queue_cull.rs b/parity/light_helpers/queue_cull.rs index 982e69e48bb..eaf0ca9c55b 100644 --- a/parity/light_helpers/queue_cull.rs +++ b/parity/light_helpers/queue_cull.rs @@ -31,7 +31,7 @@ use futures::{future, Future}; use parity_reactor::Remote; -use util::RwLock; +use parking_lot::RwLock; // Attepmt to cull once every 10 minutes. const TOKEN: TimerToken = 1; diff --git a/parity/main.rs b/parity/main.rs index 00c2199632a..485101b6600 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -34,6 +34,7 @@ extern crate isatty; extern crate jsonrpc_core; extern crate num_cpus; extern crate number_prefix; +extern crate parking_lot; extern crate regex; extern crate rlp; extern crate rpassword; diff --git a/parity/rpc_apis.rs b/parity/rpc_apis.rs index 7948d9b207a..d3171f38162 100644 --- a/parity/rpc_apis.rs +++ b/parity/rpc_apis.rs @@ -38,7 +38,7 @@ use parity_rpc::dispatch::{FullDispatcher, LightDispatcher}; use parity_rpc::informant::{ActivityNotifier, ClientNotifier}; use parity_rpc::{Metadata, NetworkSettings}; use updater::Updater; -use util::{Mutex, RwLock}; +use parking_lot::{Mutex, RwLock}; #[derive(Debug, PartialEq, Clone, Eq, Hash)] pub enum Api { diff --git a/parity/run.rs b/parity/run.rs index 093a019f3d3..c9c1283cace 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -37,8 +37,9 @@ use node_health; use parity_reactor::EventLoop; use parity_rpc::{NetworkSettings, informant, is_major_importing}; use updater::{UpdatePolicy, Updater}; -use util::{version, Mutex, Condvar}; use ansi_term::Colour; +use util::version; +use parking_lot::{Condvar, Mutex}; use node_filter::NodeFilter; use params::{ @@ -171,7 +172,7 @@ impl ::local_store::NodeInfo for FullNodeInfo { fn execute_light(cmd: RunCmd, can_restart: bool, logger: Arc) -> Result<(bool, Option), String> { use light::client as light_client; use ethsync::{LightSyncParams, LightSync, ManageNetwork}; - use util::RwLock; + use parking_lot::{Mutex, RwLock}; // load spec let spec = cmd.spec.spec(&cmd.dirs.cache)?; @@ -206,7 +207,7 @@ fn execute_light(cmd: RunCmd, can_restart: bool, logger: Arc) -> // TODO: configurable cache size. let cache = LightDataCache::new(Default::default(), ::time::Duration::minutes(GAS_CORPUS_EXPIRATION_MINUTES)); - let cache = Arc::new(::util::Mutex::new(cache)); + let cache = Arc::new(Mutex::new(cache)); // start client and create transaction queue. let mut config = light_client::Config { diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index a0bbe95cae5..daa6cf3ced0 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -15,6 +15,7 @@ futures-cpupool = "0.1" log = "0.3" multihash ="0.6" order-stat = "0.1" +parking_lot = "0.4" rand = "0.3" rust-crypto = "0.2" rustc-hex = "1.0" diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index 22f623bf6b4..b6e9c28fe40 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -28,6 +28,7 @@ extern crate futures_cpupool; extern crate itertools; extern crate multihash; extern crate order_stat; +extern crate parking_lot; extern crate rand; extern crate rustc_hex; extern crate semver; diff --git a/rpc/src/v1/helpers/dispatch.rs b/rpc/src/v1/helpers/dispatch.rs index 41fc201cf5c..96e2c8b4e3d 100644 --- a/rpc/src/v1/helpers/dispatch.rs +++ b/rpc/src/v1/helpers/dispatch.rs @@ -27,7 +27,8 @@ use light::on_demand::{request, OnDemand}; use light::TransactionQueue as LightTransactionQueue; use rlp; use hash::keccak; -use util::{Address, H520, H256, U256, Bytes, Mutex, RwLock}; +use util::{Address, H520, H256, U256, Bytes}; +use parking_lot::{Mutex, RwLock}; use stats::Corpus; use ethkey::Signature; diff --git a/rpc/src/v1/helpers/light_fetch.rs b/rpc/src/v1/helpers/light_fetch.rs index 972315272db..b46de402f6c 100644 --- a/rpc/src/v1/helpers/light_fetch.rs +++ b/rpc/src/v1/helpers/light_fetch.rs @@ -37,7 +37,8 @@ use light::on_demand::{request, OnDemand, HeaderRef, Request as OnDemandRequest, use light::request::Field; use ethsync::LightSync; -use util::{Address, Mutex, U256}; +use util::{Address, U256}; +use parking_lot::Mutex; use v1::helpers::{CallRequest as CallRequestHelper, errors, dispatch}; use v1::types::{BlockNumber, CallRequest, Log}; diff --git a/rpc/src/v1/helpers/signer.rs b/rpc/src/v1/helpers/signer.rs index 81d21eb82e4..6d9606f8780 100644 --- a/rpc/src/v1/helpers/signer.rs +++ b/rpc/src/v1/helpers/signer.rs @@ -17,7 +17,7 @@ use std::sync::Arc; use std::ops::Deref; use http::Origin; -use util::Mutex; +use parking_lot::Mutex; use transient_hashmap::TransientHashMap; use ethstore::random_string; diff --git a/rpc/src/v1/helpers/signing_queue.rs b/rpc/src/v1/helpers/signing_queue.rs index e9e6313f430..6dba2f7a26a 100644 --- a/rpc/src/v1/helpers/signing_queue.rs +++ b/rpc/src/v1/helpers/signing_queue.rs @@ -19,7 +19,8 @@ use std::cell::RefCell; use std::sync::Arc; use std::collections::BTreeMap; use jsonrpc_core; -use util::{Mutex, RwLock, U256, Address}; +use parking_lot::{Mutex, RwLock}; +use util::{U256, Address}; use ethcore::account_provider::DappId; use v1::helpers::{ConfirmationRequest, ConfirmationPayload}; use v1::types::{ConfirmationResponse, H160 as RpcH160, Origin, DappId as RpcDappId}; @@ -297,7 +298,8 @@ mod test { use std::time::Duration; use std::thread; use std::sync::{mpsc, Arc}; - use util::{Address, U256, Mutex}; + use parking_lot::Mutex; + use util::{Address, U256}; use v1::helpers::{SigningQueue, ConfirmationsQueue, QueueEvent, FilledTransactionRequest, ConfirmationPayload}; use v1::types::ConfirmationResponse; diff --git a/rpc/src/v1/helpers/subscription_manager.rs b/rpc/src/v1/helpers/subscription_manager.rs index c5e4216f439..f529d4810d7 100644 --- a/rpc/src/v1/helpers/subscription_manager.rs +++ b/rpc/src/v1/helpers/subscription_manager.rs @@ -18,7 +18,7 @@ use std::sync::Arc; use std::sync::atomic::{self, AtomicBool}; -use util::Mutex; +use parking_lot::Mutex; use jsonrpc_core::futures::future::{self, Either}; use jsonrpc_core::futures::sync::mpsc; diff --git a/rpc/src/v1/impls/eth.rs b/rpc/src/v1/impls/eth.rs index f31d3242616..30afe47711e 100644 --- a/rpc/src/v1/impls/eth.rs +++ b/rpc/src/v1/impls/eth.rs @@ -24,7 +24,7 @@ use futures::{self, future, BoxFuture, Future}; use rlp::{self, UntrustedRlp}; use time::get_time; use util::{H160, H256, Address, U256, H64}; -use util::Mutex; +use parking_lot::Mutex; use ethash::SeedHashCompute; use ethcore::account_provider::{AccountProvider, DappId}; diff --git a/rpc/src/v1/impls/eth_filter.rs b/rpc/src/v1/impls/eth_filter.rs index 8f448feb5f2..ee8e27778c7 100644 --- a/rpc/src/v1/impls/eth_filter.rs +++ b/rpc/src/v1/impls/eth_filter.rs @@ -23,7 +23,8 @@ use jsonrpc_core::*; use ethcore::miner::MinerService; use ethcore::filter::Filter as EthcoreFilter; use ethcore::client::{BlockChainClient, BlockId}; -use util::{H256, Mutex}; +use util::H256; +use parking_lot::Mutex; use futures::{future, Future, BoxFuture}; diff --git a/rpc/src/v1/impls/eth_pubsub.rs b/rpc/src/v1/impls/eth_pubsub.rs index f918a44ea8e..4eff9cdaaf2 100644 --- a/rpc/src/v1/impls/eth_pubsub.rs +++ b/rpc/src/v1/impls/eth_pubsub.rs @@ -39,7 +39,8 @@ use light::cache::Cache; use light::on_demand::OnDemand; use light::client::{LightChainClient, LightChainNotify}; use parity_reactor::Remote; -use util::{RwLock, Mutex, H256, Bytes}; +use util::{H256, Bytes}; +use parking_lot::{RwLock, Mutex}; type Client = Sink; diff --git a/rpc/src/v1/impls/light/eth.rs b/rpc/src/v1/impls/light/eth.rs index 7e40bf71a5f..c9a0b9999c3 100644 --- a/rpc/src/v1/impls/light/eth.rs +++ b/rpc/src/v1/impls/light/eth.rs @@ -39,7 +39,8 @@ use ethcore::transaction::{Action, SignedTransaction, Transaction as EthTransact use ethsync::LightSync; use rlp::UntrustedRlp; use hash::{KECCAK_NULL_RLP, KECCAK_EMPTY_LIST_RLP}; -use util::{RwLock, Mutex, U256}; +use util::U256; +use parking_lot::{RwLock, Mutex}; use futures::{future, Future, BoxFuture, IntoFuture}; use futures::sync::oneshot; diff --git a/rpc/src/v1/impls/pubsub.rs b/rpc/src/v1/impls/pubsub.rs index 616905f4ae5..44b9fcbeba2 100644 --- a/rpc/src/v1/impls/pubsub.rs +++ b/rpc/src/v1/impls/pubsub.rs @@ -18,7 +18,7 @@ use std::sync::Arc; use std::time::Duration; -use util::RwLock; +use parking_lot::RwLock; use futures::{self, BoxFuture, Future, Stream, Sink}; use jsonrpc_core::{self as core, Error, MetaIoHandler}; diff --git a/rpc/src/v1/impls/signer.rs b/rpc/src/v1/impls/signer.rs index 79f4f0e3814..a01b66364cb 100644 --- a/rpc/src/v1/impls/signer.rs +++ b/rpc/src/v1/impls/signer.rs @@ -24,7 +24,7 @@ use ethkey; use futures::{future, BoxFuture, Future, IntoFuture}; use parity_reactor::Remote; use rlp::UntrustedRlp; -use util::Mutex; +use parking_lot::Mutex; use jsonrpc_core::{futures, Error}; use jsonrpc_pubsub::SubscriptionId; diff --git a/rpc/src/v1/impls/signing.rs b/rpc/src/v1/impls/signing.rs index 23ce3c78a93..a7ef5cc1098 100644 --- a/rpc/src/v1/impls/signing.rs +++ b/rpc/src/v1/impls/signing.rs @@ -18,7 +18,8 @@ use std::sync::Arc; use transient_hashmap::TransientHashMap; -use util::{U256, Mutex}; +use parking_lot::Mutex; +use util::U256; use ethcore::account_provider::AccountProvider; diff --git a/rpc/src/v1/informant.rs b/rpc/src/v1/informant.rs index 160f0ea9f80..0cbe7d44910 100644 --- a/rpc/src/v1/informant.rs +++ b/rpc/src/v1/informant.rs @@ -24,7 +24,7 @@ use futures::Future; use futures_cpupool as pool; use jsonrpc_core as rpc; use order_stat; -use util::RwLock; +use parking_lot::RwLock; pub use self::pool::CpuPool; diff --git a/rpc/src/v1/tests/helpers/miner_service.rs b/rpc/src/v1/tests/helpers/miner_service.rs index 7139d636bb7..5670824dcb1 100644 --- a/rpc/src/v1/tests/helpers/miner_service.rs +++ b/rpc/src/v1/tests/helpers/miner_service.rs @@ -18,7 +18,8 @@ use std::collections::{BTreeMap, HashMap}; use std::collections::hash_map::Entry; -use util::{Address, H256, Bytes, U256, RwLock, Mutex}; +use util::{Address, H256, Bytes, U256}; +use parking_lot::{RwLock, Mutex}; use ethcore::error::Error; use ethcore::client::MiningBlockChainClient; use ethcore::block::ClosedBlock; diff --git a/rpc/src/v1/tests/helpers/snapshot_service.rs b/rpc/src/v1/tests/helpers/snapshot_service.rs index cfb80619a30..6d2b71aeac1 100644 --- a/rpc/src/v1/tests/helpers/snapshot_service.rs +++ b/rpc/src/v1/tests/helpers/snapshot_service.rs @@ -16,7 +16,8 @@ use ethcore::snapshot::{ManifestData, RestorationStatus, SnapshotService}; -use util::{Bytes, Mutex}; +use parking_lot::Mutex; +use util::Bytes; use util::hash::H256; /// Mocked snapshot service (used for sync info extensions). diff --git a/rpc/src/v1/tests/helpers/sync_provider.rs b/rpc/src/v1/tests/helpers/sync_provider.rs index 83c7db015ab..4498fa85eac 100644 --- a/rpc/src/v1/tests/helpers/sync_provider.rs +++ b/rpc/src/v1/tests/helpers/sync_provider.rs @@ -17,7 +17,8 @@ //! Test implementation of SyncProvider. use std::collections::BTreeMap; -use util::{H256, RwLock}; +use parking_lot::RwLock; +use util::H256; use ethsync::{SyncProvider, EthProtocolInfo, SyncStatus, SyncState, PeerInfo, TransactionStats}; /// TestSyncProvider config. diff --git a/rpc/src/v1/tests/mocked/eth.rs b/rpc/src/v1/tests/mocked/eth.rs index d1835948f7f..3338cd1bd47 100644 --- a/rpc/src/v1/tests/mocked/eth.rs +++ b/rpc/src/v1/tests/mocked/eth.rs @@ -22,7 +22,8 @@ use rustc_hex::{FromHex, ToHex}; use time::get_time; use rlp; -use util::{U256, Address, H256, Mutex}; +use util::{U256, Address, H256}; +use parking_lot::Mutex; use ethkey::Secret; use ethcore::account_provider::AccountProvider; use ethcore::client::{TestBlockChainClient, EachBlockWith, Executed, TransactionId}; diff --git a/rpc_client/Cargo.toml b/rpc_client/Cargo.toml index 1e39d8b1e04..1f1840848c1 100644 --- a/rpc_client/Cargo.toml +++ b/rpc_client/Cargo.toml @@ -15,6 +15,7 @@ serde_json = "1.0" tempdir = "0.3.5" url = "1.2.0" matches = "0.1" +parking_lot = "0.4" jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.7" } jsonrpc-ws-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.7" } parity-rpc = { path = "../rpc" } diff --git a/rpc_client/src/client.rs b/rpc_client/src/client.rs index 9c6c4ebe84c..27b72ab781e 100644 --- a/rpc_client/src/client.rs +++ b/rpc_client/src/client.rs @@ -10,7 +10,7 @@ use std::time; use std::path::PathBuf; use hash::keccak; -use util::Mutex; +use parking_lot::Mutex; use url::Url; use std::fs::File; diff --git a/rpc_client/src/lib.rs b/rpc_client/src/lib.rs index 805754b225f..7459ca9a4ca 100644 --- a/rpc_client/src/lib.rs +++ b/rpc_client/src/lib.rs @@ -6,6 +6,7 @@ extern crate futures; extern crate jsonrpc_core; extern crate jsonrpc_ws_server as ws; extern crate parity_rpc as rpc; +extern crate parking_lot; extern crate rand; extern crate serde; extern crate serde_json; diff --git a/stratum/Cargo.toml b/stratum/Cargo.toml index 9bf75779f8b..ffd933a5923 100644 --- a/stratum/Cargo.toml +++ b/stratum/Cargo.toml @@ -23,5 +23,6 @@ semver = "0.6" ethcore-ipc-nano = { path = "../ipc/nano" } futures = "0.1" tokio-core = "0.1" +parking_lot = "0.4" ethcore-logger = { path = "../logger" } hash = { path = "../util/hash" } diff --git a/stratum/src/lib.rs b/stratum/src/lib.rs index 0cffd67b699..2649436ddaa 100644 --- a/stratum/src/lib.rs +++ b/stratum/src/lib.rs @@ -26,6 +26,7 @@ extern crate semver; extern crate futures; extern crate ethcore_logger; extern crate hash; +extern crate parking_lot; #[cfg(test)] extern crate tokio_core; extern crate ethcore_devtools as devtools; @@ -56,7 +57,8 @@ use std::sync::Arc; use std::net::SocketAddr; use std::collections::{HashSet, HashMap}; use hash::keccak; -use util::{H256, RwLock, RwLockReadGuard}; +use parking_lot::{RwLock, RwLockReadGuard}; +use util::H256; type RpcResult = BoxFuture; diff --git a/sync/src/chain.rs b/sync/src/chain.rs index 432a0d0f541..822ae143dc4 100644 --- a/sync/src/chain.rs +++ b/sync/src/chain.rs @@ -93,6 +93,7 @@ use std::collections::{HashSet, HashMap}; use std::cmp; use hash::keccak; use heapsize::HeapSizeOf; +use parking_lot::RwLock; use util::*; use rlp::*; use network::*; @@ -2230,7 +2231,8 @@ mod tests { use network::PeerId; use tests::helpers::*; use tests::snapshot::TestSnapshotService; - use util::{U256, Address, RwLock}; + use parking_lot::RwLock; + use util::{U256, Address}; use util::hash::H256; use util::bytes::Bytes; use rlp::{Rlp, RlpStream, UntrustedRlp}; diff --git a/sync/src/light_sync/mod.rs b/sync/src/light_sync/mod.rs index f05e4d7d0bc..12b6ca2a885 100644 --- a/sync/src/light_sync/mod.rs +++ b/sync/src/light_sync/mod.rs @@ -45,7 +45,8 @@ use light::net::{ }; use light::request::{self, CompleteHeadersRequest as HeadersRequest}; use network::PeerId; -use util::{U256, H256, Mutex, RwLock}; +use util::{U256, H256}; +use parking_lot::{Mutex, RwLock}; use rand::{Rng, OsRng}; use self::sync_round::{AbortReason, SyncRound, ResponseContext}; diff --git a/sync/src/light_sync/tests/test_net.rs b/sync/src/light_sync/tests/test_net.rs index f6d5eddf0c6..65ddf92daa5 100644 --- a/sync/src/light_sync/tests/test_net.rs +++ b/sync/src/light_sync/tests/test_net.rs @@ -29,7 +29,7 @@ use light::client::Client as LightClient; use light::net::{LightProtocol, IoContext, Capabilities, Params as LightParams}; use light::provider::LightProvider; use network::{NodeId, PeerId}; -use util::RwLock; +use parking_lot::RwLock; use time::Duration; use light::cache::Cache; diff --git a/sync/src/tests/helpers.rs b/sync/src/tests/helpers.rs index 3ac68b0fb6d..f41d630e6e0 100644 --- a/sync/src/tests/helpers.rs +++ b/sync/src/tests/helpers.rs @@ -16,6 +16,7 @@ use std::collections::{VecDeque, HashSet, HashMap}; use std::sync::Arc; +use parking_lot::RwLock; use util::*; use network::*; use tests::snapshot::*; diff --git a/sync/src/tests/snapshot.rs b/sync/src/tests/snapshot.rs index d49bcf440ac..ba68f614306 100644 --- a/sync/src/tests/snapshot.rs +++ b/sync/src/tests/snapshot.rs @@ -17,6 +17,7 @@ use std::collections::HashMap; use std::sync::Arc; use hash::keccak; +use parking_lot::Mutex; use util::*; use ethcore::snapshot::{SnapshotService, ManifestData, RestorationStatus}; use ethcore::header::BlockNumber; diff --git a/updater/Cargo.toml b/updater/Cargo.toml index bb6557f6dfa..90dcbfeab4c 100644 --- a/updater/Cargo.toml +++ b/updater/Cargo.toml @@ -17,6 +17,7 @@ ethcore = { path = "../ethcore" } ethsync = { path = "../sync" } ethcore-util = { path = "../util" } futures = "0.1" +parking_lot = "0.4" parity-hash-fetch = { path = "../hash-fetch" } ipc-common-types = { path = "../ipc-common-types" } ethcore-ipc = { path = "../ipc/rpc" } diff --git a/updater/src/lib.rs b/updater/src/lib.rs index b27f2039eed..64b67b2dcb8 100644 --- a/updater/src/lib.rs +++ b/updater/src/lib.rs @@ -19,6 +19,7 @@ #[macro_use] extern crate log; extern crate ethcore_util as util; extern crate ipc_common_types; +extern crate parking_lot; extern crate parity_hash_fetch as hash_fetch; extern crate ethcore; extern crate ethabi; diff --git a/updater/src/updater.rs b/updater/src/updater.rs index 81768868877..5d2bb117709 100644 --- a/updater/src/updater.rs +++ b/updater/src/updater.rs @@ -31,7 +31,8 @@ use path::restrict_permissions_owner; use service::{Service}; use target_info::Target; use types::all::{ReleaseInfo, OperationsInfo, CapState}; -use util::{Address, H160, H256, Mutex, Bytes}; +use parking_lot::Mutex; +use util::{Address, H160, H256, Bytes}; use util::misc; /// Filter for releases. diff --git a/util/network/src/tests.rs b/util/network/src/tests.rs index d743318abe4..f6c8ed1e897 100644 --- a/util/network/src/tests.rs +++ b/util/network/src/tests.rs @@ -19,7 +19,8 @@ use std::sync::atomic::{AtomicBool, Ordering as AtomicOrdering}; use std::sync::Arc; use std::thread; use std::time::*; -use util::{Bytes, Mutex}; +use parking_lot::Mutex; +use util::Bytes; use io::TimerToken; use ethkey::{Random, Generator}; diff --git a/util/src/lib.rs b/util/src/lib.rs index 305b17220d8..61fc616da0b 100644 --- a/util/src/lib.rs +++ b/util/src/lib.rs @@ -145,7 +145,5 @@ pub use vector::*; pub use bigint::prelude::*; pub use bigint::hash; -pub use parking_lot::{Condvar, Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard}; - /// 160-bit integer representing account address pub type Address = H160;