Async and UI Thread with Visual Basic

Download this episode

Download Video

Description

An asynchronous method provides a convenient way to do potentially long-running work without blocking the caller's thread. The caller of an async method can resume its work without waiting for the async method to finish. Asynchrony proves especially valuable for applications that access the UI thread because all UI-related activity usually shares one thread. If any process is blocked in a synchronous application, all are blocked. Your application stops responding, and you might conclude that it has failed when instead it's just waiting. Asynchrony can be used to prevent this blocking of the UI thread resulting in a much better user experience.

In this short tutorial we look at some underlying concepts (and misconceptions) relating to the use of the Async and Await keywords in VB to implement asynchronous functions. In addition, a small demonstration program is presented and analyzed showing the specific implications of downloading a string of characters from a web service using both a synchronous and an asynchronous function.

Embed

Format

Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.