Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating from Boost.Thread to std #2700

Closed
4 tasks done
SergioRAgostinho opened this issue Dec 10, 2018 · 4 comments · Fixed by #3094
Closed
4 tasks done

Migrating from Boost.Thread to std #2700

SergioRAgostinho opened this issue Dec 10, 2018 · 4 comments · Fixed by #3094
Assignees
Milestone

Comments

@SergioRAgostinho
Copy link
Member

SergioRAgostinho commented Dec 10, 2018

I'm just opening this one to mention I'm working on it. I've incorporated the corresponding commit from #2382 and I'm building up on it.

Migration list:

@SergioRAgostinho
Copy link
Member Author

The current status:

I've migrated common and io, but there's still a number of targets in tools, apps and tests to go.

The current policy, ignoring the obvious ones, has roughly been:

  • boost::this_thread::sleep -> std::this_thread::sleep_for
  • boost::mutex::scoped_lock -> std::unique_lock<std::mutex>.

I'm currently dealing with an issue with boost::shared_lock which was used in outofcore_base.h. Shared locks are only available in the standard from 2017 onwards. Basically, converting it to a unique_lock will kill performance a little, since the shared_lock seems to be designed with the multiple reader single writer case in mind, where in the unique_lock everything is exclusive.

@taketwo
Copy link
Member

taketwo commented Dec 12, 2018

Can we just keep boost::shared_lock in that module? We are not going to drop Boost dependency anyway. Thus I don't see why we need to sacrifice performance and (potentially) introduced hard-to-catch bugs just to get rid of some Boost class?

@SunBlack
Copy link
Contributor

Shared locks are only available in the standard from 2017 onwards.

Sure? std::shared_lock is labeled as C++14 here.

@SergioRAgostinho
Copy link
Member Author

Shared locks are only available in the standard from 2017 onwards.

Sure? std::shared_lock is labeled as C++14 here.

Very very late answer. The issue comes from this line in that same page

Mutex - the type of the shared mutex to lock. The type must meet the SharedMutex requirements

However shared mutexes were only introduced in C++17. However, it appears shared timed mutexes were created for C++14 and appear to provide a superset of the functionality of the shared mutex. The shared mutex might have appeared later to reduce unwanted functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants