refactoring: Rename LockAnnotation to LockAssertion and add run-time check to it#16034
pull
practicalswift
wants to merge
4
commits into
bitcoin:master
from
practicalswift:make-sure-LockAnnotation-promises-are-truthful
changing
5
files
+33−30
practicalswift
commented at 11:45 am on May 16, 2019:
contributor
LockAnnotation lock(mutex); is a guarantee to the compiler thread-analysis that mutex is locked (when it couldn’t be determined otherwise).
Before this PR it was possible to make the mistake of adding a LockAnnotation where the correct mutex is not held. This in turn makes the thread-analysis reasoning being based on incorrect premises.
This PR adds an assertion in the LockAnnotation ctor which checks that the guarantees given by us at compile-time are held also in practice (ifdef DEBUG_LOCKORDER).
Issues like the one described in #16028 will be discovered immediately with this PR merged.
Changes in this PR:
Move LockAnnotation from threadsafety.h (imported code) to sync.h (our code)
Move LockAnnotation in wallet_tests to make it reflect the truth
Make sure the compile-time locking promises given via LockAnnotation:s hold also in practice at runtime (ifdef DEBUG_LOCKORDER)
Rename LockAnnotation to LockAssertion
fanquake added the label
Refactoring
on May 16, 2019
ryanofsky
commented at 12:13 pm on May 16, 2019:
member
This change seems reasonable, but I don’t think LockAnnotation is a good name for this class if it can potentially assert and abort the program. Would suggest adding a scripted diff to rename LockAnnotation to LockAssert or something similar.
practicalswift
commented at 1:18 pm on May 16, 2019:
contributor
@ryanofsky Thanks for the quick review! I’ve now added a scripted-diff which renames LockAnnotation to LockAssertion. Please re-review :-)
promag
commented at 2:26 pm on May 16, 2019:
member
Please update OP with the rename to LockAssertion.
practicalswift renamed this:
Add assertion to make sure the LockAnnotation guarantees we give are truthful (ifdef DEBUG_LOCKORDER)
Add assertion to make sure the LockAnnotation guarantees we give are truthful (ifdef DEBUG_LOCKORDER). Rename LockAnnotation to LockAssertion.
on May 16, 2019
practicalswift
commented at 2:49 pm on May 16, 2019:
contributor
DrahtBot
commented at 4:15 pm on May 16, 2019:
member
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Conflicts
Reviewers, this pull request conflicts with the following ones:
#15921 (Tidy up ValidationState interface by jnewbery)
#15713 (refactor: Replace chain relayTransactions/submitMemoryPool by higher method by ariard)
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
ryanofsky approved
ryanofsky
commented at 8:52 pm on May 16, 2019:
member
utACK last 4 commits of 8e81c1a87b45fea00bc0719569bd98ed61c1f6f4
Move LockAnnotation from threadsafety.h (imported code) to sync.h (our code)cc2588579c
Move LockAnnotation to make it reflect the truth3a809446b3
Make sure the compile-time locking promises given via LockAnnotation:s hold also in practice at runtime (ifdef DEBUG_LOCKORDER)de9b5dbca3
scripted-diff: Rename LockAnnotation to LockAssertion
practicalswift
commented at 11:45 am on May 17, 2019:
contributor
Rebased! Please re-review :-)
ryanofsky approved
ryanofsky
commented at 5:29 pm on May 23, 2019:
member
utACK9f85e9cb3d687862128ddf464d2bc2462b8627f0. No changes at all since last review except clean rebase after base PR #16033 was merged
MarcoFalke renamed this:
Add assertion to make sure the LockAnnotation guarantees we give are truthful (ifdef DEBUG_LOCKORDER). Rename LockAnnotation to LockAssertion.
refactoring: Rename LockAnnotation to LockAssertion and add run-time check to it
on May 23, 2019
MarcoFalke merged this
on May 23, 2019
MarcoFalke closed this
on May 23, 2019
MarcoFalke referenced this in commit
65c4bbe629
on May 23, 2019
sidhujag referenced this in commit
7fb5ee1cab
on May 24, 2019
deadalnix referenced this in commit
08a7b78cc4
on May 27, 2020
deadalnix referenced this in commit
1250f70c37
on May 28, 2020
practicalswift deleted the branch
on Apr 10, 2021
Munkybooty referenced this in commit
49329d863a
on Feb 6, 2022
Munkybooty referenced this in commit
d33ccc71ee
on Feb 15, 2022
Munkybooty referenced this in commit
0f222b40e0
on Feb 18, 2022
Munkybooty referenced this in commit
e0b084d9fd
on Feb 18, 2022
Munkybooty referenced this in commit
ee28ba8f19
on Feb 18, 2022
Munkybooty referenced this in commit
26144dffac
on Apr 21, 2022
Munkybooty referenced this in commit
cb21e05f09
on Apr 26, 2022
Munkybooty referenced this in commit
079827f80e
on May 4, 2022
Munkybooty referenced this in commit
f99bac35ad
on May 10, 2022
Munkybooty referenced this in commit
50daf4dce9
on May 17, 2022
malbit referenced this in commit
72b925f69a
on Aug 7, 2022
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2024-12-18 21:12 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me