Note I have already looked at the answer found here: Return Double from Boost thread, however the proposed solution doesn't work for me.
I have the following tid-bits of source code
void run(int tNumber, std::vector<char *>files, std::map<std::basic_string,float>word_count)
{
boost::thread_group threads;
std::map<std::basic_string,float> temp;
for(int i = 0; i < tNumber; ++i)
threads.create_thread(boost::bind(mtReadFile,files[i],boost::ref(word_count)));
threads.join_all()
}
This is the function that creates new threads for the calling process. These threads then call an instance of mtReadFile.
void mtReadFile(char *filename, std::map<std::basic_string,float> word_count)
{
//function like things
}
What I need to happen is word_count be returned from each thread to the calling process. I have tried the boost::ref in hopes of getting around the fact that boost threads copy all arguments to thread storage, but it has't worked for me.