Effective C++/WinRT for UWP and Win32

Sign in to queue

The Discussion

  • User profile image
    bkuhns

    Switching thread contexts with a `co_await` looks a little scary to me. Not because its new and different, but because it looks fragile. In production code that doesn't fit on a single slide, it seems dangerously easy to miss things and move some code that now executes on the wrong thread. 

     

    So, is it possible to dispatch code to another thread with a more contained scope like a lambda? Something like...

    MyControl.Dispatcher.Invoke([] {
        // several lines of code that *must* run on the UI thread...
    });


  • User profile image
    Smart Gotodo

    C++ becoming C#, great and awsome!

Add Your 2 Cents