-
Notifications
You must be signed in to change notification settings - Fork 290
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
[FlexiDag]Add read-write lock in dag db store #4101
Conversation
flexidag/src/blockdag.rs
Outdated
header.id(), | ||
ghostdata.selected_parent, | ||
&mut merge_set, | ||
) { | ||
); | ||
drop(reachability_writer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we don't need this drop. Please see this https://amanieu.github.io/parking_lot/parking_lot/struct.RwLock.html
Does not require any drop glue when dropped.
this is a demo from the above link.
use parking_lot::RwLock;
let lock = RwLock::new(5);
// many reader locks can be held at once
{
let r1 = lock.read();
let r2 = lock.read();
assert_eq!(*r1, 5);
assert_eq!(*r2, 5);
} // read locks are dropped at this point
// only one write lock may be held, however
{
let mut w = lock.write();
*w += 1;
assert_eq!(*w, 6);
} // write lock is dropped here
5fe9c3e
to
50b846a
Compare
flexidag/src/blockdag.rs
Outdated
|
||
self.storage | ||
.relations_store | ||
.write() | ||
.insert(real_origin, BlockHashes::new(vec![]))?; | ||
// self.storage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment code?
flexidag/tests/tests.rs
Outdated
@@ -179,7 +258,7 @@ fn test_dag_genesis_fork() { | |||
let _ghostdata = dag.ghostdata_by_hash(header.id()).unwrap().unwrap(); | |||
} | |||
|
|||
// fork, produce a new dag gensis | |||
// // fork, produce a new dag gensis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove extra // ?
fe8358a
to
b4960cc
Compare
…ock in dag commit procedure
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Other information