I test c++11 mutex in my centos computer,i try to double lock this mutex to make deadlock . But after i running it, everything is fine and no deadlock .
#include <thread>
#include <mutex>
#include <iostream>
std::mutex m;
int main()
{
m.lock();
m.lock();
std::cout<<"i am ok"<<std::endl;
return 0;
}
[zzhao010@localhost shareLibPlay]$ ./3.out
i am ok
Aucun commentaire:
Enregistrer un commentaire