Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

[XC 10.2] Remove boost::thread usage from mongo plugin #7017

Merged
merged 1 commit into from
Mar 31, 2019

Conversation

spoonincode
Copy link
Contributor

Change Description

boost::thread is problematic on some new compiler + old boost combos

Consensus Changes

  • Consensus Changes

API Changes

  • API Changes

Documentation Additions

  • Documentation Additions

boost::thread is problematic on some new compiler + old boost combos
@spoonincode spoonincode requested a review from heifner March 29, 2019 18:24
@@ -292,15 +291,15 @@ bool mongo_db_plugin_impl::filter_include( const transaction& trx ) const

template<typename Queue, typename Entry>
void mongo_db_plugin_impl::queue( Queue& queue, const Entry& e ) {
boost::mutex::scoped_lock lock( mtx );
std::unique_lock<std::mutex> lock( mtx );
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use a double check

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::lock_guard would be slightly better. But probably not worth pushing a new commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think std::lock_guard works here because the code then does things like lock.unlock(); -- unlock()/lock() isn't exposed by lock_guard AFAICT

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct. I missed the unlock()/lock()

@@ -408,7 +407,7 @@ void mongo_db_plugin_impl::consume_blocks() {
_account_controls = mongo_conn[db_name][account_controls_col];

while (true) {
boost::mutex::scoped_lock lock(mtx);
std::unique_lock<std::mutex> lock(mtx);
while ( transaction_metadata_queue.empty() &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also be std::lock_guard, but again not worth changing unless you change the one above.

@spoonincode spoonincode merged commit d5b9911 into develop Mar 31, 2019
@spoonincode spoonincode deleted the std_thread_mongo_plugin branch March 31, 2019 15:25
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.

2 participants