阅读背景:

回答错误使用线程安全计数器

来源:互联网 

I am counting a counter till 1000000 , 50 times Using 2 threads. I am using lock , but I am getting different answer every time. Why it is happening so. I thought I will get the counter value exactly 1000000 , but it is not behaving that way. What may be the reason?I am counting a counter till 1000000 , 50 times




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

分享到: