On 24 Nov 2013 at 11:16, Kyle Ketterer wrote:
Another thing to note is that when calling detach() on the thread, all of the threads execute properly and I get expected output. However, I need to call join() every x amount of threads due to OS limitations of how many threads can actually be created. I need to read about 5000 files so obviously I can't create 5000 threads as Windows maxes out at 700 I believe. I am reading files off of a RAID setup so I believe this is a situation that can benefit from multiple threads reading files.
You shouldn't use threads to read from many files in parallel - you should use the very well designed Win IOCP API to do asynchronous file operations. There is a new Boost library called AFIO in the peer review queue (http://www.boost.org/community/review_schedule.html) which extends Boost.ASIO with asynchronous file i/o support. If you don't like AFIO, use libuv which is a C library also implementing portable asynchronous file i/o. Niall -- Currently unemployed and looking for work. Work Portfolio: http://careers.stackoverflow.com/nialldouglas/