【发布时间】:2011-06-23 07:32:41
【问题描述】:
有人知道原始全局变量是否是线程安全的吗?
// global variable
int count = 0;
void thread1()
{
count++;
}
void thread2()
{
count--;
if (count == 0) print("Stuff thing");
}
如果count没有任何锁定保护,我可以这样做吗?
谢谢。
【问题讨论】:
标签: c++ multithreading