CSharp-thread

所属分类:C#编程
开发工具:Windows_Unix
文件大小:299KB
下载次数:7
上传日期:2011-08-22 17:20:10
上 传 者jake666
说明:  对于整数数据类型的简单操作,可以用  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)

文件列表:
C#线程同步的几种方法.pdf (345254, 2011-08-08)

近期下载者

相关文件


收藏者