Re: multiupload thread queue
Well, what you could do is instead of having your overriden WndProc do the uploads itself, you add it to a list and have a separate thread enumerate this list one by one and upload each file.
Re: multiupload thread queue
Hi Niya,
Thanks fer answer.
I need to upload in real time.
Each time a file is placed in the folder, I have to upload this file to my webserver.
I use WndProc to trigger my upload.
When a file is placed on the backup directory, immediatly, my application receive a message via the WndProc.
From WndProc I call my function (AutoUpload).
And sometimes I receive 3 or more messages (3 files or more in the backup directory) in few seconds.
I can not upload all files at the same time. Only 1 by 1. How to do. I think I have to declare a queue or something like that. (enqueue, dequeue)
But I don't know exactly how to do the nexts steps with the threads.
Isa
Re: multiupload thread queue
If you can't upload simultaneously then it really doesn't make any sense to create a new thread for each file at all. It would be much easier all round if you had one upload thread accessing a list of filenames. Your update process adds new files to the list. The upload thread can run on a loop, checking the list, uploading any file in the list then removing it from the list. If after this there remain items on the list upload the next, if not sleep for whatever period is appropriate.