ken2812221
commented at 3:19 pm on July 22, 2018:
contributor
Replace boost::bind with std::bind
In src/rpc/server.cpp, replace std::transform with simple loop.
In src/validation.cpp, store the boost::signals2::connection object and use it to disconnect.
In src/validationinterface.cpp, use 2 map to store the boost::signals2::scoped_connection object.
laanwj added the label
Refactoring
on Jul 22, 2018
fanquake added this to the "In progress" column in a project
fanquake renamed this:
[Refactor] Replace some boost::bind to std::bind
refactor: Replace some boost::bind to std::bind
on Jul 23, 2018
fanquake
commented at 7:31 am on July 23, 2018:
member
Concept ACK
After this boost::bind will still be used by server, scheduler and validation (and associated tests). @ken2812221 Is there a particular reason you haven’t removed that usage?
practicalswift
commented at 7:53 am on July 23, 2018:
contributor
Concept ACK, but please remove using namespace std::placeholders;. Reference _N using the fully specified std::placeholders::_N.
See developer notes:
Don’t import anything into the global namespace (using namespace ...). Use fully specified types such as std::string.
ken2812221
commented at 10:35 am on July 23, 2018:
contributor
After this boost::bind will still be used by server, scheduler and validation (and associated tests).
Is there a particular reason you haven’t removed that usage?
Those instances cannot be replaced simply boost -> std. I’ll try to get rid of those.
MarcoFalke
commented at 11:34 am on July 23, 2018:
member
I believe it is acceptable to be using using namespace std::placeholders here, since the alternative would be extremely verbose.
practicalswift
commented at 11:56 am on July 23, 2018:
contributor
@MarcoFalke I’m not sure I agree. The verbosity could help remind us that we really should use lambdas where we’re currently using std::bind (modulo the few places where that is not technically possible in C++11), no? :-)
ken2812221
commented at 12:17 pm on July 23, 2018:
contributor
@practicalswift Since @MarcoFalke think that using namespace std::placeholders; is acceptable, I will wait for more comments from other people and decide what to do.
ken2812221 force-pushed
on Jul 23, 2018
ken2812221 renamed this:
refactor: Replace some boost::bind to std::bind
refactor: Replace all boost::bind to std::bind
on Jul 23, 2018
practicalswift
commented at 1:26 pm on July 23, 2018:
contributor
@ken2812221 OK! :-) Could you try rewriting them as lambdas where appropriate? That would get rid of std::bind too :-)
ken2812221
commented at 1:49 pm on July 23, 2018:
contributor
@practicalswift Good point! I’ll try to use lambda to replace bind
Empact
commented at 5:28 pm on July 23, 2018:
member
How about using place = namespace std::placeholders; as an alternative? The calls would be relatively less verbose and would read well, e.g. std::bind(ThreadSafeMessageBox, this, place::_1, place::_2, place::_3). It would avoid polluting the global namespace, and would make the connection more explicit from source to reference.
in
src/validationinterface.cpp:95
in
d5322d3be0outdated
nit: could extract these as a method on ValidationInterfaceConnections where it would be more clear whether the method was comprehensive in its disconnecting.
in
src/validationinterface.cpp:94
in
d5322d3be0outdated
#13751 (Utils and libraries: Drops the boost/algorithm/string/split.hpp dependency by 251Labs)
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.
MarcoFalke
commented at 3:07 pm on July 25, 2018:
member
Could you sum up the differences between std::bind and lambda in the first comment for the convenience of the reviewers? It might not be obvious to everyone why lambdas should be preferred over std::bind everywhere.
ken2812221 renamed this:
refactor: Replace std/boost::bind to lambda
refactor: Replace std/boost::bind with lambda
on Jul 26, 2018
practicalswift
commented at 10:07 am on July 26, 2018:
contributor
“I’ve seen both Herb Sutter and Scott Meyers confused by bind. These are very very smart people, but bind is even more evil than they’re able to handle. I was confused by bind while maintaining bind …”
DrahtBot added the label
Needs rebase
on Aug 29, 2018
ken2812221 force-pushed
on Aug 29, 2018
ken2812221 force-pushed
on Aug 29, 2018
DrahtBot removed the label
Needs rebase
on Aug 29, 2018
in
src/qt/clientmodel.cpp:250
in
be34eeea74outdated
practicalswift
commented at 5:23 am on September 26, 2018:
Make resume_possible an unnamed parameter.
theuni
commented at 8:37 pm on September 26, 2018:
member
Please break this up into logical commits for review.
boost::bind -> std::bind makes sense to me. Concept ACK there for sure.
std::bind -> lambda seems more like a style/preference change. I prefer lambdas too, but I don’t think that justifies the churn here. Maybe when lambdas are more robust and provide a more clear win with c++14/c++17?
ken2812221 force-pushed
on Sep 27, 2018
ken2812221 renamed this:
refactor: Replace std/boost::bind with lambda
refactor: Replace boost::bind with std::bind
on Sep 27, 2018
ken2812221 force-pushed
on Sep 27, 2018
fanquake
commented at 6:53 am on September 27, 2018:
member
Travis linter is failing with:
0Running script for: fcba334f0d21161354f168a081d95a63b82fa4c51ALL_FILES=$(git ls-files -- '*.cpp' '*.h')
2for i in 1 2 3 4 5; do
3 sed -i "s/ _${i}/ std::placeholders::_${i}/g" ${ALL_FILES}
4done
5fatal: ambiguous argument '5': unknown revision or path not in the working tree.
ken2812221 force-pushed
on Sep 27, 2018
ken2812221 force-pushed
on Sep 27, 2018
ken2812221 force-pushed
on Sep 27, 2018
ken2812221 force-pushed
on Sep 27, 2018
ken2812221 force-pushed
on Sep 27, 2018
ken2812221 force-pushed
on Sep 27, 2018
ken2812221 force-pushed
on Sep 27, 2018
ken2812221
commented at 8:59 am on September 27, 2018:
contributor
Update: In this PR, I do “replace boost::bind to std::bind” only because there are some disputes about lambda.
practicalswift
commented at 9:11 am on September 27, 2018:
contributor
@ken2812221 Makes sense! Getting rid of boost/bind.hpp is a very welcome first step :-)
Empact
commented at 11:38 am on September 27, 2018:
member
Concept ACK, the callers should include <functional>
ryanofsky
commented at 3:14 pm on September 27, 2018:
It seems like these two maps would most naturally be MainSignalsInstance members. I don’t think it is good to arbitrary divide the validationinterface state up between g_signals->m_internals and these new global variables (unless there’s a specific reason for doing this that I’m not seeing).
ken2812221
commented at 11:11 am on October 14, 2018:
I was trying to do this however MainSignalsInstance is not created when RegisterWithMempoolSignals() called. So I only move g_connMainSignals into a member of MainSignalsInstance. Keeping g_connNotifyEntryRemoved as a static global variable.
in
src/validationinterface.cpp:96
in
d4a4f5729foutdated
109- g_signals.m_internals->TransactionRemovedFromMempool.disconnect(boost::bind(&CValidationInterface::TransactionRemovedFromMempool, pwalletIn, _1));
110- g_signals.m_internals->UpdatedBlockTip.disconnect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, _1, _2, _3));
111- g_signals.m_internals->NewPoWValidBlock.disconnect(boost::bind(&CValidationInterface::NewPoWValidBlock, pwalletIn, _1, _2));
112+ const auto iter = g_connMainSignals.find(pwalletIn);
113+ if (iter == g_connMainSignals.end()) return;
114+ for (const boost::signals2::connection& conn : iter->second) {
ryanofsky
commented at 3:22 pm on September 27, 2018:
I think if you used scoped_connection instead of connection types you could get rid of this for loop.
Also, since this for loop is the only thing that appears to iterate over std::array<9> objects, it might be a good idea to replace std::array with a plain struct if you do eliminate this loop. (I noticed you used a ValidationInterfaceConnections struct in a previous version of this PR).
ken2812221
commented at 11:12 am on October 14, 2018:
That idea looks good to me. I’ll take it.
ryanofsky approved
ryanofsky
commented at 3:28 pm on September 27, 2018:
member
utACKd4a4f5729f0faa3bc51c6f162a10812c9703d5a5. I also think it’d be good to switch to lambdas in the future.
ken2812221 force-pushed
on Sep 27, 2018
ken2812221 force-pushed
on Sep 27, 2018
ken2812221 force-pushed
on Sep 27, 2018
ken2812221 force-pushed
on Sep 27, 2018
ken2812221 force-pushed
on Sep 27, 2018
ken2812221 force-pushed
on Sep 30, 2018
ken2812221 force-pushed
on Sep 30, 2018
ken2812221 force-pushed
on Sep 30, 2018
ken2812221 force-pushed
on Oct 14, 2018
ken2812221 force-pushed
on Oct 14, 2018
ken2812221 force-pushed
on Oct 14, 2018
ken2812221 renamed this:
refactor: Replace boost::bind with std::bind
[WIP] refactor: Replace boost::bind with std::bind
on Oct 14, 2018
ken2812221 force-pushed
on Oct 14, 2018
ken2812221 force-pushed
on Oct 14, 2018
ken2812221 renamed this:
[WIP] refactor: Replace boost::bind with std::bind
refactor: Replace boost::bind with std::bind
on Oct 14, 2018
ken2812221 force-pushed
on Oct 14, 2018
sipa
commented at 7:56 am on October 17, 2018:
member
Can this be implemented as a scripted diff? It looks relatively straightforward.
ken2812221 force-pushed
on Oct 17, 2018
ken2812221 force-pushed
on Oct 17, 2018
ken2812221 force-pushed
on Oct 17, 2018
ken2812221 force-pushed
on Oct 17, 2018
ken2812221 force-pushed
on Oct 17, 2018
ken2812221 force-pushed
on Oct 17, 2018
ken2812221 force-pushed
on Oct 17, 2018
ken2812221 force-pushed
on Oct 17, 2018
ken2812221 force-pushed
on Oct 17, 2018
ken2812221
commented at 4:02 pm on October 17, 2018:
contributor
@sipa Done. Apparently I can’t use ${i} as the script’s variable.
ken2812221 force-pushed
on Oct 17, 2018
ken2812221 force-pushed
on Oct 17, 2018
ken2812221 force-pushed
on Oct 17, 2018
in
src/validationinterface.cpp:57
in
a280bcc010outdated
ryanofsky
commented at 5:37 pm on October 19, 2018:
Following up on #13743 (review), I think it would be good to add a comment saying that this has to a separate global instead of a member of MainSignalsInstance, because RegisterWithMempoolSignals is currently called before RegisterBackgroundSignalScheduler, so MainSignalsInstance hasn’t been created yet.
Init code is more messy than it needs to be and I think saying what current dependencies are will make it easier to clean up later.
ken2812221
commented at 0:39 am on October 22, 2018:
DoneDone
ryanofsky approved
ryanofsky
commented at 5:54 pm on October 19, 2018:
member
utACK52532ee43720520696d452424daad213b50aef1f. Changes since last review are adding scripted diff, removing one global, and switching to scoped signal connections.
Apparently I can’t use ${i} as the script’s variable.
It looks like this happens because commit-script-check.sh uses $i and calls eval "$SCRIPT" without a subshell. It would be nice to fix this to prevent confusion and ensure the diff checking is correct.
refactor: Use boost::scoped_connection in signal/slot, also prefer range-based loop instead of std::transform2196c51821
scripted-diff: Replace boost::bind with std::bind
-BEGIN VERIFY SCRIPT-
for j in $(seq 1 5)
do
sed -i "s/ _${j}/ std::placeholders::_${j}/g" $(git grep --name-only " _${j}" -- '*.cpp' '*.h')
done
sed -i "s/boost::bind/std::bind/g" $(git grep --name-only boost::bind -- '*.cpp' '*.h')
sed -i "s/boost::ref/std::ref/g" $(git grep --name-only boost::ref -- '*.cpp' '*.h')
sed -i '/boost\/bind/d' $(git grep --name-only boost/bind)
-END VERIFY SCRIPT-
cb53b825c2
ken2812221 force-pushed
on Oct 19, 2018
ryanofsky approved
ryanofsky
commented at 4:02 pm on October 22, 2018:
member
utACKcb53b825c26af6e628ba88d72b2000e75bedbbc6. Only change is last review is new comment.
sipa
commented at 2:10 am on October 23, 2018:
member
utACKcb53b825c26af6e628ba88d72b2000e75bedbbc6
ryanofsky
commented at 4:41 pm on December 4, 2018:
member
Can this be merged, or does it need more review? I see review from @theuni was requested in github, but I don’t know if it’s necessary given the other reviews since this change is pretty straightforward.
fanquake
commented at 4:59 am on December 29, 2018:
member
utACKcb53b82
practicalswift
commented at 10:30 am on December 29, 2018:
contributor
utACKcb53b825c26af6e628ba88d72b2000e75bedbbc6
MarcoFalke merged this
on Dec 29, 2018
MarcoFalke closed this
on Dec 29, 2018
MarcoFalke referenced this in commit
cbb91cd0ec
on Dec 29, 2018
fanquake removed review request from theuni
on Dec 29, 2018
ken2812221 deleted the branch
on Dec 29, 2018
fanquake moved this from the "In progress" to the "Done" column in a project
fanquake referenced this in commit
c4be50fea3
on Aug 31, 2020
fanquake referenced this in commit
9876ab8c74
on Sep 3, 2020
kittywhiskers referenced this in commit
370f8d2257
on Jul 13, 2021
kittywhiskers referenced this in commit
5556ff4bd3
on Jul 13, 2021
PastaPastaPasta referenced this in commit
c6db9b52dc
on Aug 2, 2021
kittywhiskers referenced this in commit
28450f52e5
on Aug 3, 2021
kittywhiskers referenced this in commit
61aeaea5c9
on Aug 8, 2021
UdjinM6 referenced this in commit
28790e6d32
on Aug 11, 2021
kittywhiskers referenced this in commit
0b5f7f3267
on Aug 12, 2021
UdjinM6 referenced this in commit
607bd4b6b5
on Aug 13, 2021
dzutto referenced this in commit
94047645f7
on Aug 16, 2021
dzutto referenced this in commit
afe85cb2e9
on Aug 16, 2021
dzutto referenced this in commit
8ea5b389fe
on Aug 16, 2021
dzutto referenced this in commit
453cb7fdcd
on Aug 17, 2021
UdjinM6 referenced this in commit
4b603e64e4
on Aug 17, 2021
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-11-17 06:12 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me