Add,
BitTestAndComplement, BitTestAndReset, BitTestAndSet,
CompareExchange, Exchange, ExchangeAdd,
https://msdn.microsoft.com/zh-cn/data/ms684122
https://msdn.microsoft.com/zh-cn/data/ms686360
http://blog.csdn.net/zhongguoren666/article/details/7542975
InterlockedAdd | Performs an atomic addition operation on the specified LONG values. |
InterlockedAddAcquire | Performs an atomic addition operation on the specified LONG values. The operation is performed with acquire memory ordering semantics. |
InterlockedAddRelease | Performs an atomic addition operation on the specified LONG values. The operation is performed with release memory ordering semantics. |
InterlockedAddNoFence | Performs an atomic addition operation on the specified LONG values. The operation is performed atomically, but without using memory barriers |
InterlockedAdd64 | Performs an atomic addition operation on the specified LONGLONG values. |
InterlockedAddAcquire64 | Performs an atomic addition operation on the specified LONGLONG values. The operation is performed with acquire memory ordering semantics. |
InterlockedAddRelease64 | Performs an atomic addition operation on the specified LONGLONG values. The operation is performed with release memory ordering semantics. |
InterlockedAddNoFence64 | Performs an atomic addition operation on the specified LONGLONG values. The operation is performed atomically, but without using memory barriers |
InterlockedAnd | Performs an atomic AND operation on the specified LONG values. |
InterlockedAndAcquire | Performs an atomic AND operation on the specified LONG values. The operation is performed with acquire memory ordering semantics. |
InterlockedAndRelease | Performs an atomic AND operation on the specified LONG values. The operation is performed with release memory ordering semantics. |
InterlockedAndNoFence | Performs an atomic AND operation on the specified LONG values. The operation is performed atomically, but without using memory barriers |
InterlockedAnd8 | Performs an atomic AND operation on the specified char values. |
InterlockedAnd8Acquire | Performs an atomic AND operation on the specified char values. The operation is performed with acquire memory ordering semantics. |
InterlockedAnd8Release | Performs an atomic AND operation on the specified char values. The operation is performed with release memory ordering semantics. |
InterlockedAnd8NoFence | Performs an atomic AND operation on the specified char values. The operation is performed atomically, but without using memory barriers |
InterlockedAnd16 | Performs an atomic AND operation on the specified SHORT values. |
InterlockedAnd16Acquire | Performs an atomic AND operation on the specified SHORT values. The operation is performed with acquire memory ordering semantics. |
InterlockedAnd16Release | Performs an atomic AND operation on the specified SHORT values. The operation is performed with release memory ordering semantics. |
InterlockedAnd16NoFence | Performs an atomic AND operation on the specified SHORT values. The operation is performed atomically, but without using memory barriers |
InterlockedAnd64 | Performs an atomic AND operation on the specified LONGLONG values. |
InterlockedAnd64Acquire | Performs an atomic AND operation on the specified LONGLONG values. The operation is performed with acquire memory ordering semantics. |
InterlockedAnd64Release | Performs an atomic AND operation on the specified LONGLONG values. The operation is performed with release memory ordering semantics. |
InterlockedAnd64NoFence | Performs an atomic AND operation on the specified LONGLONG values. The operation is performed atomically, but without using memory barriers |
InterlockedBitTestAndComplement | Tests the specified bit of the specified LONG value and complements it. |
InterlockedBitTestAndComplement64 | Tests the specified bit of the specified LONG64 value and complements it. The operation is atomic |
InterlockedBitTestAndResetAcquire | Tests the specified bit of the specified LONG value and sets it to 0. The operation is atomic, and it is performed with acquire memory ordering semantics |
InterlockedBitTestAndResetRelease | Tests the specified bit of the specified LONG value and sets it to 0. The operation is atomic, and it is performed using memory release semantics |
InterlockedBitTestAndSetAcquire | Tests the specified bit of the specified LONG value and sets it to 1. The operation is atomic, and it is performed with acquire memory ordering semantics |
InterlockedBitTestAndSetRelease | Tests the specified bit of the specified LONG value and sets it to 1. The operation is atomic, and it is performed with release memory ordering semantics |
InterlockedBitTestAndReset | Tests the specified bit of the specified LONG value and sets it to 0. |
InterlockedBitTestAndReset64 | Tests the specified bit of the specified LONG64 value and sets it to 0. |
InterlockedBitTestAndSet | Tests the specified bit of the specified LONG value and sets it to 1. |
InterlockedBitTestAndSet64 | Tests the specified bit of the specified LONG64 value and sets it to 1. |
InterlockedCompare64Exchange128 | Performs an atomic compare-and-exchange operation on the specified values. The function compares the specified 64-bit values and exchanges with the specified 128-bit value based on the outcome of the comparison. |
InterlockedCompare64ExchangeAcquire128 | Performs an atomic compare-and-exchange operation on the specified values. The function compares the specified 64-bit values and exchanges with the specified 128-bit value based on the outcome of the comparison. The operation is performed with acquire memory ordering semantics. |
InterlockedCompare64ExchangeRelease128 | Performs an atomic compare-and-exchange operation on the specified values. The function compares the specified 64-bit values and exchanges with the specified 128-bit value based on the outcome of the comparison. The operation is performed with release memory ordering semantics. |
InterlockedCompareExchange | Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 32-bit values and exchanges with another 32-bit value based on the outcome of the comparison. |
InterlockedCompareExchangeAcquire | Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 32-bit values and exchanges with another 32-bit value based on the outcome of the comparison. The operation is performed with acquire memory ordering semantics. |
InterlockedCompareExchangeRelease | Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 32-bit values and exchanges with another 32-bit value based on the outcome of the comparison. The exchange is performed with release memory ordering semantics. |
InterlockedCompareExchangeNoFence | Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 32-bit values and exchanges with another 32-bit value based on the outcome of the comparison. The operation is performed atomically, but without using memory barriers |
InterlockedCompareExchange64 | Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 64-bit values and exchanges with another 64-bit value based on the outcome of the comparison. |
InterlockedCompareExchangeAcquire64 | Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 64-bit values and exchanges with another 64-bit value based on the outcome of the comparison. The exchange is performed with acquire memory ordering semantics. |
InterlockedCompareExchangeRelease64 | Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 64-bit values and exchanges with another 64-bit value based on the outcome of the comparison. The exchange is performed with release memory ordering semantics. |
InterlockedCompareExchangeNoFence64 | Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 64-bit values and exchanges with another 64-bit value based on the outcome of the comparison. The operation is performed atomically, but without using memory barriers |
InterlockedCompareExchange16 | Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 16-bit values and exchanges with another 16-bit value based on the outcome of the comparison |
InterlockedCompareExchange16Acquire | Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 16-bit values and exchanges with another 16-bit value based on the outcome of the comparison. The operation is performed with acquire memory ordering semantics |
InterlockedCompareExchange16Release | Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 16-bit values and exchanges with another 16-bit value based on the outcome of the comparison. The exchange is performed with release memory ordering semantics |
InterlockedCompareExchange16NoFence | Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 16-bit values and exchanges with another 16-bit value based on the outcome of the comparison. The operation is performed atomically, but without using memory barriers |
InterlockedCompareExchange128 | Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 128-bit values and exchanges with another 128-bit value based on the outcome of the comparison |
InterlockedCompareExchangePointer | Performs an atomic compare-and-exchange operation on the specified pointer values. The function compares two specified pointer values and exchanges with another pointer value based on the outcome of the comparison. |
InterlockedCompareExchangePointerAcquire | Performs an atomic compare-and-exchange operation on the specified pointer values. The function compares two specified pointer values and exchanges with another pointer value based on the outcome of the comparison. The operation is performed with acquire memory ordering semantics. |
InterlockedCompareExchangePointerRelease | Performs an atomic compare-and-exchange operation on the specified pointer values. The function compares two specified pointer values and exchanges with another pointer value based on the outcome of the comparison. The operation is performed with release memory ordering semantics. |
InterlockedCompareExchangePointerNoFence | Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified pointer values and exchanges with another pointer value based on the outcome of the comparison. The operation is performed atomically, but without using memory barriers |
InterlockedDecrement | Decrements (decreases by one) the value of the specified 32-bit variable as an atomic operation. |
InterlockedDecrementAcquire | Decrements (decreases by one) the value of the specified 32-bit variable as an atomic operation. The operation is performed with acquire memory ordering semantics. |
InterlockedDecrementRelease | Decrements (decreases by one) the value of the specified 32-bit variable as an atomic operation. The operation is performed with release memory ordering semantics. |
InterlockedDecrementNoFence | Decrements (decreases by one) the value of the specified 32-bit variable as an atomic operation. The operation is performed atomically, but without using memory barriers |
InterlockedDecrement16 | Decrements (decreases by one) the value of the specified 16-bit variable as an atomic operation |
InterlockedDecrement16Acquire | Decrements (decreases by one) the value of the specified 16-bit variable as an atomic operation. The operation is performed with acquire memory ordering semantics |
InterlockedDecrement16Release | Decrements (decreases by one) the value of the specified 16-bit variable as an atomic operation. The operation is performed with release memory ordering semantics |
InterlockedDecrement16NoFence | Decrements (decreases by one) the value of the specified 16-bit variable as an atomic operation. The operation is performed atomically, but without using memory barriers |
InterlockedDecrement64 | Decrements (decreases by one) the value of the specified 64-bit variable as an atomic operation. |
InterlockedDecrementAcquire64 | Decrements (decreases by one) the value of the specified 64-bit variable as an atomic operation. The operation is performed with acquire memory ordering semantics. |
InterlockedDecrementRelease64 | Decrements (decreases by one) the value of the specified 64-bit variable as an atomic operation. The operation is performed with release memory ordering semantics. |
InterlockedDecrementNoFence64 | Decrements (decreases by one) the value of the specified 64-bit variable as an atomic operation. The operation is performed atomically, but without using memory barriers |
InterlockedExchange | Sets a 32-bit variable to the specified value as an atomic operation. |
InterlockedExchangeAcquire | Sets a 32-bit variable to the specified value as an atomic operation. The operation is performed with acquire memory ordering semantics. |
InterlockedExchangeNoFence | Sets a 64-bit variable to the specified value as an atomic operation. The operation is performed atomically, but without using memory barriers |
InterlockedExchange8 | Sets an 8-bit variable to the specified value as an atomic operation |
InterlockedExchange16 | Sets a 16-bit variable to the specified value as an atomic operation. |
InterlockedExchange16Acquire | Sets a 16-bit variable to the specified value as an atomic operation. The operation is performed using acquire memory ordering semantics |
InterlockedExchange16NoFence | Sets a 16-bit variable to the specified value as an atomic operation. The operation is performed atomically, but without using memory barriers |
InterlockedExchange64 | Sets a 64-bit variable to the specified value as an atomic operation. |
InterlockedExchangeAcquire64 | Sets a 32-bit variable to the specified value as an atomic operation. The operation is performed with acquire memory ordering semantics. |
InterlockedExchangeNoFence64 | Sets a 64-bit variable to the specified value as an atomic operation. The operation is performed atomically, but without using memory barriers |
InterlockedExchangePointer | Atomically exchanges a pair of pointer values. |
InterlockedExchangePointerAcquire | Atomically exchanges a pair of pointer values. The operation is performed with acquire memory ordering semantics. |
InterlockedExchangePointerNoFence | Atomically exchanges a pair of addresses. The operation is performed atomically, but without using memory barriers |
InterlockedExchangeSubtract | Performs an atomic subtraction of two values. |
InterlockedExchangeAdd | Performs an atomic addition of two 32-bit values. |
InterlockedExchangeAddAcquire | Performs an atomic addition of two 32-bit values. The operation is performed with acquire memory ordering semantics. |
InterlockedExchangeAddRelease | Performs an atomic addition of two 32-bit values. The operation is performed with release memory ordering semantics. |
InterlockedExchangeAddNoFence | Performs an atomic addition of two 32-bit values. The operation is performed atomically, but without using memory barriers |
InterlockedExchangeAdd64 | Performs an atomic addition of two 64-bit values. |
InterlockedExchangeAddAcquire64 | Performs an atomic addition of two 64-bit values. The operation is performed with acquire memory ordering semantics. |
InterlockedExchangeAddRelease64 | Performs an atomic addition of two 64-bit values. The operation is performed with release memory ordering semantics. |
InterlockedExchangeAddNoFence64 | Performs an atomic addition of two 64-bit values. The operation is performed atomically, but without using memory barriers |
InterlockedIncrement | Increments (increases by one) the value of the specified 32-bit variable as an atomic operation. |
InterlockedIncrementAcquire | Increments (increases by one) the value of the specified 32-bit variable as an atomic operation. The operation is performed using acquire memory ordering semantics. |
InterlockedIncrementRelease | Increments (increases by one) the value of the specified 32-bit variable as an atomic operation. The operation is performed using release memory ordering semantics. |
InterlockedIncrementNoFence | Increments (increases by one) the value of the specified 32-bit variable as an atomic operation. The operation is performed atomically, but without using memory barriers |
InterlockedIncrement16 | Increments (increases by one) the value of the specified 16-bit variable as an atomic operation |
InterlockedIncrement16Acquire | Increments (increases by one) the value of the specified 16-bit variable as an atomic operation. The operation is performed using acquire memory ordering semantics |
InterlockedIncrement16Release | Increments (increases by one) the value of the specified 16-bit variable as an atomic operation. The operation is performed using release memory ordering semantics |
InterlockedIncrement16NoFence | Increments (increases by one) the value of the specified 16-bit variable as an atomic operation. The operation is performed atomically, but without using memory barriers |
InterlockedIncrement64 | Increments (increases by one) the value of the specified 64-bit variable as an atomic operation. |
InterlockedIncrementAcquire64 | Increments (increases by one) the value of the specified 64-bit variable as an atomic operation. The operation is performed using acquire memory ordering semantics. |
InterlockedIncrementRelease64 | Increments (increases by one) the value of the specified 64-bit variable as an atomic operation. The operation is performed using release memory ordering semantics. |
InterlockedIncrementNoFence64 | Increments (increases by one) the value of the specified 64-bit variable as an atomic operation. The operation is performed atomically, but without using memory barriers |
InterlockedOr | Performs an atomic OR operation on the specified LONG values. |
InterlockedOrAcquire | Performs an atomic OR operation on the specified LONG values. The operation is performed with acquire memory ordering semantics. |
InterlockedOrRelease | Performs an atomic OR operation on the specified LONG values. The operation is performed with release memory ordering semantics. |
InterlockedOrNoFence | Performs an atomic OR operation on the specified LONG values. The operation is performed atomically, but without using memory barriers |
InterlockedOr8 | Performs an atomic OR operation on the specified char values. |
InterlockedOr8Acquire | Performs an atomic OR operation on the specified char values. The operation is performed with acquire memory ordering semantics. |
InterlockedOr8Release | Performs an atomic OR operation on the specified char values. The operation is performed with release memory ordering semantics. |
InterlockedOr8NoFence | Performs an atomic OR operation on the specified char values. The operation is performed atomically, but without using memory barriers |
InterlockedOr16 | Performs an atomic OR operation on the specified SHORT values. |
InterlockedOr16Acquire | Performs an atomic OR operation on the specified SHORT values. The operation is performed with acquire memory ordering semantics. |
InterlockedOr16Release | Performs an atomic OR operation on the specified SHORT values. The operation is performed with release memory ordering semantics. |
InterlockedOr16NoFence | Performs an atomic OR operation on the specified SHORT values. The operation is performed atomically, but without using memory barriers |
InterlockedOr64 | Performs an atomic OR operation on the specified LONGLONG values. |
InterlockedOr64Acquire | Performs an atomic OR operation on the specified LONGLONG values. The operation is performed with acquire memory ordering semantics. |
InterlockedOr64Release | Performs an atomic OR operation on the specified LONGLONG values. The operation is performed with release memory ordering semantics. |
InterlockedOr64NoFence | Performs an atomic OR operation on the specified LONGLONG values. The operation is performed atomically, but without using memory barriers |
InterlockedXor | Performs an atomic XOR operation on the specified LONG values. |
InterlockedXorAcquire | Performs an atomic XOR operation on the specified LONG values. The operation is performed with acquire memory ordering semantics. |
InterlockedXorRelease | Performs an atomic XOR operation on the specified LONG values. The operation is performed with release memory ordering semantics. |
InterlockedXorNoFence | Performs an atomic XOR operation on the specified LONG values. The operation is performed atomically, but without using memory barriers |
InterlockedXor8 | Performs an atomic XOR operation on the specified char values. |
InterlockedXor8Acquire | Performs an atomic XOR operation on the specified char values. The operation is performed with acquire memory ordering semantics. |
InterlockedXor8Release | Performs an atomic XOR operation on the specified char values. The operation is performed with release memory ordering semantics. |
InterlockedXor8NoFence | Performs an atomic XOR operation on the specified char values. The operation is performed atomically, but without using memory barriers |
InterlockedXor16 | Performs an atomic XOR operation on the specified SHORT values. |
InterlockedXor16Acquire | Performs an atomic XOR operation on the specified SHORT values. The operation is performed with acquire memory ordering semantics. |
InterlockedXor16Release | Performs an atomic XOR operation on the specified SHORT values. The operation is performed with release memory ordering semantics. |
InterlockedXor16NoFence | Performs an atomic XOR operation on the specified SHORT values. The operation is performed atomically, but without using memory barriers |
InterlockedXor64 | Performs an atomic XOR operation on the specified LONGLONG values. |
InterlockedXor64Acquire | Performs an atomic XOR operation on the specified LONGLONG values. The operation is performed with acquire memory ordering semantics. |
InterlockedXor64Release | Performs an atomic XOR operation on the specified LONGLONG values. The operation is performed with release memory ordering semantics. |
InterlockedXor64NoFence | Performs an atomic XOR operation on the specified LONGLONG values. The operation is performed atomically, but without using memory barriers |
相关推荐
C#使用Interlocked实现线程同步 在多线程编程中,线程同步是非常重要的,因为多个线程可能会访问同一资源,导致数据不一致、混乱或崩溃。C#提供了多种方式来实现线程同步,包括使用锁、信号量、事件等,而...
C#中的`System.Threading.Interlocked`类提供了一系列的静态方法,用于执行线程安全的原子操作,避免了锁机制带来的开销。在本文中,我们将深入探讨`Interlocked`类的工作原理以及如何在实践中应用它。 首先,我们...
为了提高并发性能并避免潜在的数据竞争问题,开发人员可以使用高级方法,如Interlocked类。Interlocked类提供了在多个线程共享变量时执行原子操作的能力,从而避免了传统锁机制可能导致的性能瓶颈和死锁风险。 ...
在大多数计算机上,增加变量操作不是一个原子操作,需要执行下列步骤: 一:将实例变量中的值加载到寄存器中。 二:增加或减少该值。 三:在实例变量中存储该值。... Interlocked.Decrement以原子操作的形式递减
本主题将深入探讨三种常见的锁机制:Lock、Monitor和Interlocked,并通过代码示例来对比它们的性能表现。 首先,Lock是C#中一种显式的锁定机制,基于 Monitor 类实现。它提供了一种互斥访问共享资源的方式,确保...
在IT行业中,"Interlocked Circles"通常是指一种编程概念,它涉及到并发和多线程环境中的数据同步问题。在这样的环境下,多个线程可能同时访问和修改同一块内存,导致数据不一致或错误。为了解决这个问题,开发人员...
api-ms-win-core-interlocked-l1-1-0
常用的线程锁分为一下七种:volatile关键字、Lock锁、System.Threading.Interlocked原子级别操作、Monitor、Metux、ReaderWriterLock、EventWaitHandle同步事件。此次代码中包含了以上除了volatile的测试代码
A single event upset (SEU) tolerant latch with a triple-interlocked structure is presented. Its self-recovery mechanism is implemented by using three pairs of guard-gates and inverters to construct ...
多线程同步Interlocked。多线程中,部分任务需要进行同步操作,对线程进行加锁操作,确保某个任务A抢到资源进行时,其他任务暂停等待,直到任务完成,其他任务才会顺序执行,类似于线程队列。此时可以使用lock,...
一、进程内部的线程同步 1、使用lock,用法如下: private static readonly object SeqLock = new ...其在System.Threading命名空间下,Interlocked实际是类控制计数器,从而实现进程的同步,其很容易实现生产者消费
`Monitor`, `lock`关键字,或者`Interlocked`类可用于保护共享资源。 7. **异步编程和Task**:在.NET Framework 4.0及更高版本中,推荐使用异步编程模型,如`async`和`await`关键字,以及`Task`类。虽然这不是直接...
本示例"ExampleLock.zip"集中展示了如何在C#中解决并发问题,特别是通过使用悲观并发策略和Interlocked原子操作。 首先,我们需要理解什么是并发。并发是指多个任务或线程在同一时间间隔内执行,这在现代多核处理器...
根据给定的信息,本文将详细解析C#中的线程池实现方法,并重点介绍如何通过Mutex与Interlocked等机制来管理线程同步。 ### C#线程池的基本概念 线程池是C#中用于管理线程的一种高效机制,它允许程序在运行时动态地...