Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multithreaded File copying, is it possible?

Status
Not open for further replies.

fenris

Programmer
May 20, 1999
824
CA
I want to emulate one of my java programs in VB. It is a multithreaded file copying program that is based on a que class that I created. It works great, unfortunately java is a pain to distribute to non-java users!

I am not even sure VB can handle threads in the same manor that java can handle them. I put some thought into this and came up with simply creating a file copy class and just creating an array of file copy objects to handle the copying. The only problem that I don't know how to address is locking the access to the que while another thread is getting the file it is supposed to copy. In other words each thread must only be able to copy a unique file.

for example the que could contain 4 files of different sizes.

que:

file1
file2
file3
file4

Say we have two threads, it is simple to give the first thread the first file and the second thread the second file. after the initial assignment of files to the threads, I want the first thread that is done copying to retrieve the next file in the que, but I also want to make sure that it is not given to another thread at the same time. how would this be accomplished in VB?




Troy Williams B.Eng.
fenris@hotmail.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top