hi,
I wanted to get the directories in a specific path
and I wrote that by threading programming
but when I call
waithandle.waitall(mywaithandles)
, I get the
unhandled exception of type 'System.ArgumentNullException' occurred in mscorlib.dll
Additional information: Value cannot be null.
error.
Can anyone help me what to do ?
there is my code of this part:
<MTAThread()> Public Sub file_search()
Dim DD() As String = Directory.GetDirectories(Searcher_path)
Dim num_of_dirs As Integer = get_unemptyfolders_num(DD)
Dim mywaithandles(num_of_dirs) As AutoResetEvent
For i As Integer = 0 To DD.Length - 1
If is_emty(DD(i))=false Then
num_of_dirs -= 1
mywaithandles(num_of_dirs) = New AutoResetEvent(False)
Dim th_info As Threadinfo = New Threadinfo(DD(i), mywaithandles(num_of_dirs))
ThreadPool.QueueUserWorkItem(AddressOf searcher_thread, th_info)
End If
Next
WaitHandle.WaitAll(mywaithandles)
end sub