In Chapter 9, Building Responsive UIs, we talked about achieving responsiveness with visual meaning. In this chapter, we are going to discuss the particular ability of an application to look responsive to the user even when some time-consuming or computationally heavy operation is ongoing.
In this section, we will learn about the thread safety of UI frameworks. We will also learn how to distinguish between synchronous and asynchronous code execution. This will also need a discussion about synchronization techniques to mix and merge the two approaches.
If you are an experienced programmer, you will surely have been in situations where the UI of your applications seemed to freeze because of some heavy computation (long loops, network calls, or other I/O operations). The general behavior is to have a blank window or a frozen one, and the user has no choice other than killing the application or patiently waiting for the operation to complete, even if the application...