阅读背景:

在不同的线程中作为一个类的成员函数使用是否安全?

来源:互联网 

For example:

例如:

struct A {    
void run1() {}
void run2() {}    
};

int main()
{
  A a;

  thread t1(bind(&A::run1, ref(a)));
  thread t2(bind(&A::run2, ref(a)));

  // not joinable thread!

  int i;
  std::cin >> i;
}
struct A {    
void run1()



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: