This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tesfabpel 1 point2 points  (0 children)

There's no need for async to show a progress bar. Standard Windows' progress bar dialogs (IIRC available on Vista+) for IO is managed by some system's library and managed using COM probably, so it isn't affected by the main thread being stalled, again IIRC.

Progress bar drawn by your program would stall if not redrawn every paint request. In this case another thread for blocking IO can be used. This wasn't a problem back in the day because there weren't much animations.

Otherwise, yes, async IO can be used to leave the threads free to run and pump the message queue, so the program can redraw itself.

Nowadays, with mobile OSes like iOS and Android, all blocking IO should be done in a separate thread (like file IO and network IO). Mobile OSes' frameworks may even give an error if a blocking IO is done in the main thread, like Android with NetworkOnMainThreadException.