dimanche 5 novembre 2017

Meaning of "([&]()" (Threading in C++)

I found this code on http://ift.tt/2d04Eyx 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;
});

Aucun commentaire:

Enregistrer un commentaire