-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[XC 10.2] Remove boost::thread usage from mongo plugin #7017
Conversation
boost::thread is problematic on some new compiler + old boost combos
@@ -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 ); |
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.
This could use a double check
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.
std::lock_guard
would be slightly better. But probably not worth pushing a new commit.
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.
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
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.
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() && |
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.
This could also be std::lock_guard
, but again not worth changing unless you change the one above.
Change Description
boost::thread is problematic on some new compiler + old boost combos
Consensus Changes
API Changes
Documentation Additions