1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
Private _Links As New System.Collections.Generic.Queue(Of String)
Private _Verrou As New Object
Private Function GetLink() As String
SyncLock _Verrou
If _Links.Count = 0 Then Return Nothing
Return _Links.Dequeue
End SyncLock
End Function
Private Sub StartThreadsDL()
For i As Integer = 0 To 10
Dim th As New System.Threading.Thread(AddressOf DL)
th.IsBackground = True
th.Start()
Next
End Sub
Private Sub DL()
While True
Dim l As String = GetLink()
If l Is Nothing Then Exit Sub
'traitement pour récupérer
MonProgressBar.Invoke(New Action(AddressOf MajProgressBar))
End While
End Sub
Private Sub MajProgressBar()
'faire +1 sur le progressbar
End Sub |