Advertisement
deseven

raceCondition&global

May 5th, 2015
833
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; race condition & global variable
  2.  
  3. Global Dim someArray.i(1000)
  4. Global i
  5.  
  6. Procedure fillArray(number.i)
  7.   For i = 0 To ArraySize(someArray())
  8.     someArray(i) = number*1000000
  9.   Next
  10. EndProcedure
  11.  
  12. CreateThread(@fillArray(),0)
  13. CreateThread(@fillArray(),1)
  14. CreateThread(@fillArray(),2)
  15. CreateThread(@fillArray(),3)
  16. CreateThread(@fillArray(),4)
  17. CreateThread(@fillArray(),5)
  18.  
  19. Delay(100)
  20.  
  21. For i = 0 To ArraySize(someArray())
  22.   Debug someArray(i)
  23. Next
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement