Why does this throw an std::system_error ?
I was playing around with threads to improve some code.....with no luck whatsoever..
Any way.. I tried to get the following loop running concurrently.
Code:
for(auto x=args.begin();x!=args.end();x++)
{
list l;
if(is_list(*x,l)) *x = l.eval();
}
My try:
Code:
std::vector<std::thread> threads;
list temp;
for(auto x=args.begin();x!=args.end();x++)
if(is_list(*x,temp))
threads.push_back(std::thread([](list l,std::string& ret){ret = l.eval();},temp,*x));
for(auto t = threads.begin();t!=threads.end();t++)t->join();
(Notice that the list is passed by value...to avoid mishaps)
But clearly something(else?) has gone wrong...
N.B: list is NOT std::list