Skip to content

Conversation

CodeShark
Copy link
Contributor

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.

CCriticalSection mutex;
boost::recursive_mutex mutex;

LOCK(mutex); // uses the local variable criticalblock for RAII
Copy link
Member

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?

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/3d07cf2b6bee9ef1ecfbb54cd8f08904857a22e4 for binaries and test log.

@BitcoinPullTester
Copy link

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();
Copy link
Member

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.

@CodeShark
Copy link
Contributor Author

I was being facetious in my last commit, obviously...

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/f260a599a075f84f220343b2dae4264d8225324c for binaries and test log.

1 similar comment
@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/f260a599a075f84f220343b2dae4264d8225324c for binaries and test log.

@sipa
Copy link
Member

sipa commented Feb 5, 2013

ACK if you squeeze the two commits together.

@sipa
Copy link
Member

sipa commented Apr 7, 2013

Can you please squeeze these together?

@jgarzik
Copy link
Contributor

jgarzik commented May 30, 2013

Poke @CodeShark

@sipa
Copy link
Member

sipa commented Jun 22, 2013

Please squeeze? puppyeyes

@sipa
Copy link
Member

sipa commented Jun 25, 2013

ACK

sipa added a commit that referenced this pull request Jun 26, 2013
Added comments to sync.h to make it easier to understand the macros
@sipa sipa merged commit 1f2d739 into bitcoin:master Jun 26, 2013
owlhooter pushed a commit to owlhooter/mazacoin-new that referenced this pull request Oct 11, 2018
* Archive release notes 0.12.3.1

* Release notes 0.12.3.2

* add 2175

* add 2176
guruvan added a commit to guruvan/maza that referenced this pull request Nov 8, 2018
* 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)
  ...
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants