等待所有线程池

时间:2014-09-18 16:04:13

标签: vb.net threadpool

我需要等待所有线程池完成才能继续。有人可以帮我吗。我想我需要一系列的manualresetevent但是不能完全得到它。感谢。

For Each _pdsDir In _config.PDSDirectories
            If Directory.Exists(_pdsDir.ScanDir) Then
                Dim _copyInfo As New CopyInfo
                _copyInfo.ext = ".txt"
                _copyInfo.ScanDir = _pdsDir
                _copyInfo.HoldDir = _config.PDSHoldDirectory
                If _config.Threading Then
                    ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf CopyToHold), _copyInfo)  
                Else
                    CopyToHold(_copyInfo)
                End If
            Else
                LogMessages("PDS Directory does not exist: " + _pdsDir.ScanDir, Reflection.MethodBase.GetCurrentMethod.Name, "816", "E", False, True)
            End If
        Next

0 个答案:

没有答案
相关问题