**** Merged from MCS ****
[mono-project.git] / mcs / btests / SyncLockA.vb
blobf43dd2d050b471305a5fb9e41424e522f6e93971
1 REM LineNo: 14
2 REM ExpectedError: BC30752
3 REM ErrorMessage: 'On Error' statements are not valid within 'SyncLock' statements.
5 Imports System
7 Module SyncLockA
9 Class C
11 Private Shared count = 0
13 Sub IncrementCount()
14 Console.WriteLine("Before acquiring lock, Count is {0}", count)
15 SyncLock GetType(C)
16 System.Threading.Thread.Sleep(1000)
17 count += 1
18 Console.WriteLine(count)
19 End SyncLock
20 Console.WriteLine("After releasing lock, Count is {0}", count)
21 End Sub
23 End Class
25 Sub Main()
26 Dim c As New C()
28 Dim td1 As New System.Threading.Thread( _
29 AddressOf c.IncrementCount)
30 td1.Start()
32 c.IncrementCount()
33 End Sub
35 End Module