Threads Synchronization

So far, you have learned how to create and run new threads of execution to split big operations across multiple threads. This is useful, but there is a problem: Imagine that you have multiple threads accessing the same data source simultaneously: What happens to the data source, and how are threads handled to avoid errors? This is a problem that is solved with thread synchronization. The idea is that, when a thread accesses a resource, this resource is locked until the required operations are completed to prevent other threads from accessing that resource. Visual Basic and the .NET Framework provide keywords and objects, respectively, to accomplish threads synchronization, as covered in the next subsections.

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.