P
pbd22
Hi.
I am getting the error: "Thread is running or terminated. It cannot
restart." It is happening inside a file upload loop where
a thread is created for each file (reporting bytes). After the first
file is uploaded, the error is thrown at workThread.Start().
I am new to threading and would appreciate advice on how to code this
so when the next file is starting to upload, the thread is restarted
(reinstantiated).
Below is a little on the function and the code:
---------------------------------------------------------
I have a function SendVideo().
Inside the function I have a thread that counts bytes:
Code:
Dim workThread As New Thread(New ThreadStart(AddressOf ftp.doWork))
Further down, I have a loop that starts the thread before the
upload begins and calls join after each upload:
Code:
For iFile = 0 To myfiles.Count - 1
workThread.Start()
ftp.UploadFile(postedFile.FileName)
workThread.Join()
End If
Next iFile
workThread.Start() above is where the error is thrown after the first
upload.
Thanks....
I am getting the error: "Thread is running or terminated. It cannot
restart." It is happening inside a file upload loop where
a thread is created for each file (reporting bytes). After the first
file is uploaded, the error is thrown at workThread.Start().
I am new to threading and would appreciate advice on how to code this
so when the next file is starting to upload, the thread is restarted
(reinstantiated).
Below is a little on the function and the code:
---------------------------------------------------------
I have a function SendVideo().
Inside the function I have a thread that counts bytes:
Code:
Dim workThread As New Thread(New ThreadStart(AddressOf ftp.doWork))
Further down, I have a loop that starts the thread before the
upload begins and calls join after each upload:
Code:
For iFile = 0 To myfiles.Count - 1
workThread.Start()
ftp.UploadFile(postedFile.FileName)
workThread.Join()
End If
Next iFile
workThread.Start() above is where the error is thrown after the first
upload.
Thanks....