Hi,
Imagine that i have a vector container, which contains a list of items that need downloading, and i want X amount of these items to download simultaneously.
These items are being transfered over a custom protocol, not something standard like http so i cant use a pre made library, rather im dealing with raw socket operations.
How do i create a decent stable architecture for this purpose?
So my vector is going be the thread safe queue object so to speak, that my download objects will access, then process the item from the vector.
Problem is whats the best design approach to do this?
I have been looking at the Boost library for threading, but some people have said i can just use asynchronous I/O and eliminate the need for threads, but i have no idea how i would implement asio?
My idea for threading would be to have 1 socket / download object per thread, and each thread would lock/unlock the vector queue when required. Would this work? or is it over the top?
I'm really just after a good understanding of the design so i can implement it as hassle free as possible because threading is scary
.
This is for linux, so does anyone know if theres any existing code for this type of design i could use, or look at for ideas, any library's that exist?
Thanks for any help,
Jason
Imagine that i have a vector container, which contains a list of items that need downloading, and i want X amount of these items to download simultaneously.
These items are being transfered over a custom protocol, not something standard like http so i cant use a pre made library, rather im dealing with raw socket operations.
How do i create a decent stable architecture for this purpose?
So my vector is going be the thread safe queue object so to speak, that my download objects will access, then process the item from the vector.
Problem is whats the best design approach to do this?
I have been looking at the Boost library for threading, but some people have said i can just use asynchronous I/O and eliminate the need for threads, but i have no idea how i would implement asio?
My idea for threading would be to have 1 socket / download object per thread, and each thread would lock/unlock the vector queue when required. Would this work? or is it over the top?
I'm really just after a good understanding of the design so i can implement it as hassle free as possible because threading is scary

This is for linux, so does anyone know if theres any existing code for this type of design i could use, or look at for ideas, any library's that exist?
Thanks for any help,
Jason