replace synchronization primitives with those from parking_lot (#1593)
* parking_lot in cargo.toml * replace all lock invocations with parking_lot ones * use parking_lot synchronization primitives
This commit is contained in:
committed by
Gav Wood
parent
4226c0f631
commit
36d3d0d7d7
@@ -18,17 +18,18 @@
|
||||
use std::ptr;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{RwLock, Arc};
|
||||
use std::sync::Arc;
|
||||
use std::path::Path;
|
||||
use bloomchain::{Number, Config as BloomConfig};
|
||||
use bloomchain::group::{BloomGroupDatabase, BloomGroupChain, GroupPosition, BloomGroup};
|
||||
use util::{H256, H264, Database, DatabaseConfig, DBTransaction, RwLockable};
|
||||
use util::{H256, H264, Database, DatabaseConfig, DBTransaction, RwLock};
|
||||
use header::BlockNumber;
|
||||
use trace::{BlockTraces, LocalizedTrace, Config, Switch, Filter, Database as TraceDatabase, ImportRequest, DatabaseExtras, Error};
|
||||
use db::{Key, Writable, Readable, CacheUpdatePolicy};
|
||||
use blooms;
|
||||
use super::flat::{FlatTrace, FlatBlockTraces, FlatTransactionTraces};
|
||||
|
||||
|
||||
const TRACE_DB_VER: &'static [u8] = b"1.0";
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
@@ -231,7 +232,7 @@ impl<T> TraceDatabase for TraceDB<T> where T: DatabaseExtras {
|
||||
|
||||
// at first, let's insert new block traces
|
||||
{
|
||||
let mut traces = self.traces.unwrapped_write();
|
||||
let mut traces = self.traces.write();
|
||||
// it's important to use overwrite here,
|
||||
// cause this value might be queried by hash later
|
||||
batch.write_with_cache(traces.deref_mut(), request.block_hash, request.traces, CacheUpdatePolicy::Overwrite);
|
||||
@@ -259,7 +260,7 @@ impl<T> TraceDatabase for TraceDB<T> where T: DatabaseExtras {
|
||||
.map(|p| (From::from(p.0), From::from(p.1)))
|
||||
.collect::<HashMap<TraceGroupPosition, blooms::BloomGroup>>();
|
||||
|
||||
let mut blooms = self.blooms.unwrapped_write();
|
||||
let mut blooms = self.blooms.write();
|
||||
batch.extend_with_cache(blooms.deref_mut(), blooms_to_insert, CacheUpdatePolicy::Remove);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user