[SERVER-62724] Minimize the coroutine support kludges Created: 18/Jan/22  Updated: 31/Jan/22  Resolved: 29/Jan/22

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

Type: Bug Priority: Major - P3
Reporter: Billy Donahue Assignee: Billy Donahue
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Sprint: Service Arch 2022-1-24, Service Arch 2022-2-07
Participants:

 Description   

Stay out of namespace std.
Use a mongo::coro or mongo::stdx namespace for coroutine support.
Remove reliance on gcc 11.0 <coroutine> header, as it's in toolchain v4.



 Comments   
Comment by Billy Donahue [ 31/Jan/22 ]

Final state of coroutine kludges:

  • The mongo::coro namespace is introduced as an alias to either std:: or std::experimental controlled by platform ifdefs.

There are basically three coroutine platform scenarios.

    - native support (MSVC22, GCC11, clang>=14)
        - no kludges (mongo::coro -> std)
 
    - clang -fcoroutines-ts with libc++ (XCode)
        - no kludges (mongo::coro -> std::experimental)
 
    - clang -fcoroutines-ts with libstdc++ (Evergreen clang builders)
        - (mongo::coro -> std::experimental)
        - #define __cpp_impl_coroutine to trick libstdc++ <coroutine> ifdef block.
        - inject std::coroutine_handle and std::coroutine_traits into std::experimental
          (compiler emits references to these names and they don't exist in libstdc++).

Comment by Billy Donahue [ 20/Jan/22 ]

We can also un-comment the Task type now that we're in GCC11 (v4 toolchain). It works fine now.

Comment by Billy Donahue [ 18/Jan/22 ]

https://github.com/10gen/mongo/tree/billydonahue/coroutines_improvements

Generated at Thu Feb 08 05:55:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.