I found this code on https://www.classes.cs.uchicago.edu/archive/2013/spring/12300-1/labs/lab6/ where the producer-consumer problem is explained. What is the meaning of ([&]()
? Below is a section of the code, where the syntax is used.
thread reporter([&]() {
/*
unique_lock<mutex> lock(m);
while (!notified) {
cond_var.wait(lock);
}
*/
cout << "The value is " << value << endl;
});