Thread.Sleep(1) BUG

simong

New member
Joined
May 10, 2010
Messages
2
Programming Experience
1-3
why this following code don't give a list (test) with each elements different ? :confused::

Dim test As New List(Of Integer)
For i As Integer = 0 To 20
SyncLock test
Threading.Thread.Sleep(1)
test.Add(Now.Second & Now.Millisecond)
End SyncLock
Next

result with a Intel Core 2 Quad CPU and .net 4 targeting x86 :
(0) 25901 Integer
(1) 25901 Integer
(2) 25901 Integer
(3) 25901 Integer
(4) 25901 Integer
(5) 25901 Integer
(6) 25901 Integer
(7) 25901 Integer
(8) 25917 Integer
(9) 25917 Integer
(10) 25917 Integer
(11) 25917 Integer
(12) 25917 Integer
(13) 25917 Integer
(14) 25917 Integer
(15) 25917 Integer
(16) 25932 Integer
(17) 25932 Integer
(18) 25932 Integer
(19) 25932 Integer
(20) 25932 Integer
 

simong

New member
Joined
May 10, 2010
Messages
2
Programming Experience
1-3
Thanks,
May i know what version of .net, visual studio and processor you used?
i have tried with my coworkers computer and got the same 'bug'.
 
Top Bottom