简介 目前我有一个子程序,我需要递归调用。我每次需要它时都会在一个单独的线程中调用它。例如:
Private Sub process_part_for_tkv(ByVal a As String, ByVal b As Integer, ByVal c As Integer, ByVal d As String)
'Do stuff
For Loop 'sudo code just to show a loop is used
Dim process_part_for_tkv_thread As New Threading.Thread(Sub() process_part_for_tkv(newa, newb, newc, newd))
process_part_for_tkv_thread.IsBackground = True
process_part_for_tkv_thread.Priority = Threading.ThreadPriority.Highest
process_part_for_tkv_thread.Start()
Next
End Sub
然后我会调用初始子来运行:
Dim process_part_for_tkv_thread As New Threading.Thread(Sub() process_part_for_tkv(newa, newb, newc, newd))
process_part_for_tkv_thread.IsBackground = True
process_part_for_tkv_thread.Priority = Threading.ThreadPriority.Highest
process_part_for_tkv_thread.Start()
问题
线程工作正常但我怎么能告诉我的所有线程何时运行完毕?有没有办法跟踪这个?