SyncLock block : SyncLock « Thread « VB.Net Tutorial






Imports System
Imports System.Collections


Class MainClass
    Public Sub New()

     Dim myCollection As New ArrayList()
     Dim item As Object
     SyncLock myCollection.SyncRoot
         For Each item In myCollection
          ' Insert your code here.
         Next item
     End SyncLock
    End Sub 
End Class








23.8.SyncLock
23.8.1.SyncLock
23.8.2.Producer and consumer with SyncLock
23.8.3.Use SyncLock for shared resources
23.8.4.SyncLock block