[SERVER-17310] Provide stdx polyfills for std:: implementation of boost concurrency types Created: 17/Feb/15  Updated: 25/Jan/17  Resolved: 28/May/15

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 3.1.4

Type: Improvement Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: Andy Schwerin
Resolution: Done Votes: 0
Labels: C++11
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-19760 Cannot compile on osx with gcc4.8/4.9/+ Closed
Backwards Compatibility: Fully Compatible
Participants:

 Description   

Now that we are on C++11 and have boost 1.56, we can, presumably make the choice of whether to use the std or boost components for concurrency (this may require that we polyfill the chrono components as well).



 Comments   
Comment by Githook User [ 19/May/15 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-17310 Add polyfills for types from the <thread>, <mutex> and <condition_variable> headers.

Demonstrate usage in mongo/util/concurrency/ticketholder.

{h,cpp}

.
Branch: master
https://github.com/mongodb/mongo/commit/e699454322eb5f02cc5ea865421188664382f150

Comment by Githook User [ 19/May/15 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-17310 Rewrite V8 deadline monitor thread to eliminate use of boost::thread::interrupt().

Boost thread interruption has no direct analog in C++11, so must be removed.
Branch: master
https://github.com/mongodb/mongo/commit/95f2a43a398f07121d04af800bacd139eb43d7cd

Comment by Githook User [ 19/May/15 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-17310 Remove use of boost::thread_group and boost::thread::interrupt from fail_point_test.

These behaviors do not have direct analogs in the C++11 thread support, so must be removed.
Branch: master
https://github.com/mongodb/mongo/commit/1626ee600966ac99fd8a8045fb2a3a37cd6f9274

Comment by Githook User [ 19/May/15 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-17310 Provide stdx polyfill for std::this_thread. Stop using boost::this_thread.
Branch: master
https://github.com/mongodb/mongo/commit/9ab64834372d7d4c651bd41496f98afb7f44fbf7

Comment by Githook User [ 12/Mar/15 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-17310 Make mongo::mutex a typedef of boost::mutex and remove mongo::scoped_lock.
Branch: master
https://github.com/mongodb/mongo/commit/7cd9cf303c824478f0f6d60cadfcc1a25bdb21f2

Comment by Githook User [ 05/Mar/15 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-17310 Replace boost::*_mutex::scoped_lock with boost::lock_guard.

Achieved via grep, sed and bash:
grep -Irl mutex::scoped_lock src/mongo | xargs sed -i.orig -E 's/(boost::(recursive_|timed_)?)mutex::scoped_lock/boost::lock_guard<\1mutex>/'

Then, by converting boost::lock_guard to boost::unique_lock as appropriate.

Finally, by removing unused mongo::mutex::try_lock.
Branch: master
https://github.com/mongodb/mongo/commit/59a9a04651486763b49ddb706a195bebccf76642

Comment by Andy Schwerin [ 02/Mar/15 ]

Proposed plan of attack:

  1. Replace boost::*_mutex::scoped_lock uses with boost::unique_lock<*_mutex>
  2. Replace mongo::mutex with boost::mutex
  3. Introduce stdx:: polyfill for concurrency types based on boost implementation, only. Types and namespaces to introduce are as follows:
    1. stdx::this_thread in mongo/stdx/thread.h
    2. stdx::thread in mongo/stdx/thread.h
    3. stdx::mutex in mongo/stdx/mutex.h
    4. stdx::timed_mutex in mongo/stdx/mutex.h
    5. stdx::recursive_mtuex in mongo/stdx/mutex.h
    6. stdx::condition_variable in mongo/stdx/condition_variable.h
  4. Convert all boost:: references to the introduced types to stdx:: refeferences
  5. Convert remaining calls to non-C+11 interfaces to C+11 equivalents. This will require stdx::chrono.
  6. Introduce standard library implementation of polyfill on supported platforms
Generated at Thu Feb 08 03:43:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.