May 2010
Intermediate to advanced
1272 pages
61h 18m
English
SyncLock..End SyncLock StatementThe Visual Basic language offers the SyncLock..End SyncLock statement that is the place where you can grant access to the specified resource to only one thread per time. For example, imagine you have a class where you define a list of customers and a method for adding a new customer to the list, as demonstrated by the following code snippet:

Basically the preceding code locks the entire enclosing class, preventing other threads from accessing the instance until the requested operation completes. By the way, locking an entire class is not always the best idea, because it can be expensive in terms of resources ...
Read now
Unlock full access