- reduces some functional overhead and simplifies the code
[Qt] rework setNumBlocks to have blockDate as parameter #5776
pull Diapolo wants to merge 1 commits into bitcoin:master from Diapolo:qt_lock changing 7 files +28 −23-
Diapolo commented at 10:52 AM on February 9, 2015: none
- gmaxwell added the label GUI on Feb 10, 2015
-
in src/qt/clientmodel.cpp:None in 960cdc1a66 outdated
59 | @@ -60,9 +60,11 @@ int ClientModel::getNumConnections(unsigned int flags) const 60 | return nNum; 61 | } 62 | 63 | -int ClientModel::getNumBlocks() const 64 | +int ClientModel::getNumBlocks(bool fLock) const 65 | { 66 | - LOCK(cs_main); 67 | + if (fLock) 68 | + LOCK(cs_main);
laanwj commented at 8:40 AM on March 9, 2015:This cannot work. LOCK locks within the current scope, which is empty here.
laanwj commented at 8:43 AM on March 9, 2015:Instead of a boolean argument (boolean arguments tend to make code unreadable), it is better done by having two functions:
int getNumBlocksWithLock() const { LOCK(cs_main); return getNumBlocks(); } int getNumBlocks() const { return chainActive.Height(); }But as we use recursive locks everywhere there should be no reason to. If you have the lock, taking it again i harmless.
laanwj commented at 8:47 AM on March 9, 2015: memberConcept ACK. It is better to have necessary information be part of the message. Please remove the locking changes, they are incorrect and unnecessary.
8517e9709e[Qt] rework setNumBlocks to have blockDate as parameter
- reduces some functional overhead and simplifies the code
laanwj merged this on Mar 9, 2015laanwj closed this on Mar 9, 2015laanwj referenced this in commit f50120ab4d on Mar 9, 2015Diapolo deleted the branch on Mar 9, 2015MarcoFalke locked this on Sep 8, 2021
github-metadata-mirror
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: 2026-04-21 18:15 UTC
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: 2026-04-21 18:15 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me