I was wondering if it was possible to access data from an array inside a threaded function after it has finished executing?
Take this example:
Code:
#include <iostream>
#include <boost/thread.hpp>
using namespace std;
void workerFunc(int start){
int arr[5];
int i;
for(i = 0; i < 5; i++){
arr[i] = start;
start++;
}
}
int main(){
boost::thread workerThread(workerFunc, 3);
workerThread.join();
return 0;
}
After workerFunc has finished, how could I access the array arr? Is there any way to get (3,4,5,6,7) back into main()?
Thank You