Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.IO
- Imports System.Threading
- Imports System.Threading.Tasks
- Friend Module Optimise
- Friend Results() As Single
- Sub Go()
- Parallel.Invoke(New Action(AddressOf Optimise), New Action(AddressOf ExportResults))
- End Sub
- Sub Optimise()
- redim results(1000)
- For i = 1 To 1000
- 'results(i) = do some calcs
- 'do I need to lock results() somehow? Or as ExportResults() is the only other thing accessing am I OK to leave unlocked?
- Next
- End Sub
- Sub ExportResults()
- 'how can this thread monitor results()?
- '(is results locked?)
- 'How can it access results without interupting optimise() thread?
- End Sub
- End Module
Add Comment
Please, Sign In to add comment