shared_mutex mm;
int cale = 0;
void shared_mutex_Test(string url)
{
while (true)
{
mm.lock();
printf(“%s–>%d\n”, url.c_str(),cale);
cale++;
mm.unlock();
Sleep(100);
}
}
int main()
{
std::thread t1(shared_mutex_Test, “Thread1*”);
std::thread t2(shared_mutex_Test, “Thread2*”);
t2.join();
t1.join();
}