0

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;
});
Yakk - Adam Nevraumont
  • 235,777
  • 25
  • 285
  • 465
SAFD
  • 143
  • 1
  • 1
  • 9

0 Answers0