文件名称:CSharp-thread
介绍说明--下载内容均来自于网络,请自行研究使用
对于整数数据类型的简单操作,可以用  Interlocked  类的成员来实现线程同步,存在于  System.Threading  命名空
间。Interlocked类有以下方法:Increment  ,  Decrement  ,  Exchange  和  CompareExchange  。使用  Increment  和 
Decrement  可以保证对一个整数的加减为一个原子操作。Exchange  方法自动交换指定变量的值。 
CompareExchange  方法组合了两个操作:比较两个值以及根据比较的结果将第三个值存储在其中一个变量中。比
较和交换操作也是按原子操作执行的-For integer data types of simple operation, members of the Interlocked class can be used to achieve thread synchronization, exist in the System.Threading namespace. Interlocked class has the following methods: Increment, Decrement, Exchange and CompareExchange. You can use the Increment and Decrement integer addition and subtraction of a guarantee as an atomic operation. Exchange method of automatic exchange value of the specified variable. CompareExchange method combines two operations: comparing two values and compare the results according to the third value is stored in one variable. Compare and exchange operation is performed by atomic
间。Interlocked类有以下方法:Increment  ,  Decrement  ,  Exchange  和  CompareExchange  。使用  Increment  和 
Decrement  可以保证对一个整数的加减为一个原子操作。Exchange  方法自动交换指定变量的值。 
CompareExchange  方法组合了两个操作:比较两个值以及根据比较的结果将第三个值存储在其中一个变量中。比
较和交换操作也是按原子操作执行的-For integer data types of simple operation, members of the Interlocked class can be used to achieve thread synchronization, exist in the System.Threading namespace. Interlocked class has the following methods: Increment, Decrement, Exchange and CompareExchange. You can use the Increment and Decrement integer addition and subtraction of a guarantee as an atomic operation. Exchange method of automatic exchange value of the specified variable. CompareExchange method combines two operations: comparing two values and compare the results according to the third value is stored in one variable. Compare and exchange operation is performed by atomic
(系统自动生成,下载前可以参看下载内容)
下载文件列表
C#线程同步的几种方法.pdf