GoingNative 39: await/coroutines

Play GoingNative 39: await/coroutines
Sign in to queue




Download this episode

The Discussion

  • User profile image

    Nice presentation.

    When I first heard about "await", I mistakenly thought it was very ugly that we would be adding a keyword to the language (await) that is hard coded to depended on a library type (std::future). That seemed backwards. Now I learned that its not that bad. Await is not hardcoded to the std::future type but is more general than that. If a better std::future is invented in the future (pun). It will work with that also.

    On a lighter note. I like the wallpaper. Where can I get that? It looks algorithmic, similar to Roger Penrose's non repeating tiling patterns.

  • User profile image

    @petke79: Thanks for the kind words and for watching! If you really want to know, I'll try to find out for you ;) Email me at gaha at microsoft!

  • User profile image

    Hi, do you have some full example code for expected<int> and await example?
    I am curious how the full code looks.

  • User profile image

    For await, look at the examples in awaitable section starting 32. In particular, slide 44 how to write an await adapter to call OS APIs directly bypassing any intermediaries such as futures or tasks.


    Expansion for expected would look something like this (it will be enabled in 2015 VS Update 1, RTM does not support it):

    template <typename T> bool await_ready(expected<T> & e) { return e.has_value(); }

    template <typename T> T& await_resume(expected<T> & e) { return e.value(); }

    template <typename T, typename P> 
    void await_suspend(expected<T> & e, coroutine_handle<P> & p) {



  • User profile image

    Tnx Gor.

  • User profile image

    The following simple app triggers breakpoint several times (int 3 instruction). Then just hangs.

    Is this feature working in 2015 RTM?

    #include <experimental\generator>
    #include <future>

    using namespace std;
    using namespace std::experimental;

    future<int> get_int()
    return async([] { return 0; });

    future<int> wait_int()
    return __await get_int();

    int main()
    auto const i = wait_int().get();
    return 0;

  • User profile image


    Can you double check that you don't have /ZI (Edit and Continue Debugging) switch on?

    It is in project properties | C/C++ | General | Debug Information Format.

    Please switch to /Zi (small i). Edit and continue debugging codegen is not compatible at the moment with coroutines.

Add Your 2 Cents