码迷,mamicode.com
首页 > Web开发 > 详细

.NET:race conditions

时间:2015-01-27 00:08:31      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:

race conditions (when an anomalous result occurs due to an unexpected critical dependence on the timing of two events).

A race condition occurs when two or more threads can access shared data and they try to change it at the same time. Because the thread scheduling algorithm can swap between threads at any time, you don‘t know the order in which the threads will attempt to access the shared data. Therefore, the result of the change in data is dependent on the thread scheduling algorithm, i.e. both threads are "racing" to access/change the data.

Problems often occur when one thread does a "check-then-act" (e.g. "check" if the value is X, then "act" to do something that depends on the value being X) and another thread does something to the value in between the "check" and the "act".

 

http://stackoverflow.com/questions/34510/what-is-a-race-condition

.NET:race conditions

标签:

原文地址:http://www.cnblogs.com/happyframework/p/4251528.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!