2

The Windows Runtime heavily uses asynchronous patterns, offloading long(-er) running tasks to the thread pool. I've read through all articles in Threading and async programming, but couldn't find an answer to my question:

Are all Windows Runtime asynchronous calls guaranteed to return at some point?

1
  • 3
    As much as any synchronous call is guaranteed to return at some point! Commented May 19, 2019 at 17:28

1 Answer 1

1

As @Paulo mentions in the comments, this depends entirely on the how the code is written. It is easy to write your own async code that never returns, and it is trivial to deadlock your application using platform APIs by doing a .Wait() from the UI thread.

Fundamentally, an async operation is a function that returns an object (often called a "promise" or a "future") and then that object either sets an event or calls a callback function at some future point in time (this is the "logical" return value of the async operation).

Either part of this could fail -- the initial function might never get around to returning the promise object, or the promise might never get around to calling the callback / setting the event.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.