-
Notifications
You must be signed in to change notification settings - Fork 37.8k
Added comments to sync.h to make it easier to understand the macros #2174
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
Conversation
CCriticalSection mutex; | ||
boost::recursive_mutex mutex; | ||
|
||
LOCK(mutex); // uses the local variable criticalblock for RAII |
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.
Why not write it using the variable name criticalblock below, then?
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/3d07cf2b6bee9ef1ecfbb54cd8f08904857a22e4 for binaries and test log. |
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/fcbc2d8427bfef6066ae3fd5638976548bdd2c42 for binaries and test log. |
|
||
LOCK(mutex); | ||
boost::unique_lock<boost::recursive_mutex> criticalblock(mutex); | ||
criticalblock.lock(); |
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.
Actually, this lock call is implicit when using the constructor used above.
I was being facetious in my last commit, obviously... |
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/f260a599a075f84f220343b2dae4264d8225324c for binaries and test log. |
1 similar comment
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/f260a599a075f84f220343b2dae4264d8225324c for binaries and test log. |
ACK if you squeeze the two commits together. |
Can you please squeeze these together? |
Poke @CodeShark |
Please squeeze? puppyeyes |
ACK |
Added comments to sync.h to make it easier to understand the macros
* Archive release notes 0.12.3.1 * Release notes 0.12.3.2 * add 2175 * add 2176
* MAZA-POS: (5575 commits) Mazafication of code More mazafication More mazafications and compile correction fixes fix for build issues fix for build issues fix string in net.cpp correct pow.cpp correct validation.cpp fixing for build errors fix typo Merge remote-tracking branch 'origin/MAZA-POS' into MAZA-POS merge to dash rebase Release notes 0.12.3.3 Remove redundant parameter fCheckDuplicateInputs from CheckTransaction Fix crash bug with duplicate inputs within a transaction Bump to 0.12.3.3 Release notes 0.12.3.2 (bitcoin#2174) Add tests for special rules for slow blocks on devnet/testnet (bitcoin#2176) Allow mining min diff for very slow (2h+) blocks (bitcoin#2175) Fix issues with selections on Masternode tab (bitcoin#2170) Sync mn list and mnw list from 3 peers max (bitcoin#2169) A few devnet related fixes (bitcoin#2168) Adjust diff for slow testnet/devnet blocks a bit smoother (bitcoin#2161) Make PS Buttons not react to spacebar (bitcoin#2154) Bump to 0.12.3.2 (bitcoin#2173) Bump to 0.12.3.1 (bitcoin#2158) Update release notes (bitcoin#2155) Use correct protocol when serializing messages in reply to `getdata` (bitcoin#2157) Fix p2pkh tests asserts (bitcoin#2153) Fix block value/payee validation in lite mode (bitcoin#2148) ...
Having taken me a while (i.e. more than the couple seconds it should take) to painstakingly decipher all the synchronization macros, I decided to add some comments to sync.h explaining in simple terms what the macros really translate to once you remove all the excess nonfunctional debug code.
I welcome all of you who have more experience with the code to chime in and point out where I'm going wrong, what to add, and how it can be improved.
I fully support using debugging frameworks - but let's at least clean this up so that it's both easy for a human to read AND easy to set up debugging options - for people who haven't necessarily been dealing with this stuff daily for months.