]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLibInternals.h
MdePkg/BaseSynchronizationLib: Add InterlockedCompareExchange16
[mirror_edk2.git] / MdePkg / Library / BaseSynchronizationLib / BaseSynchronizationLibInternals.h
index e42824c75d12152b246432b9fd19631d5fe8e0ef..76f7023241560f416e510f09523d89103b53477b 100644 (file)
@@ -62,6 +62,32 @@ InternalSyncDecrement (
   );\r
 \r
 \r
+/**\r
+  Performs an atomic compare exchange operation on a 16-bit unsigned integer.\r
+\r
+  Performs an atomic compare exchange operation on the 16-bit unsigned integer\r
+  specified by Value.  If Value is equal to CompareValue, then Value is set to\r
+  ExchangeValue and CompareValue is returned.  If Value is not equal to CompareValue,\r
+  then Value is returned.  The compare exchange operation must be performed using\r
+  MP safe mechanisms.\r
+\r
+  @param  Value         A pointer to the 16-bit value for the compare exchange\r
+                        operation.\r
+  @param  CompareValue  A 16-bit value used in compare operation.\r
+  @param  ExchangeValue A 16-bit value used in exchange operation.\r
+\r
+  @return The original *Value before exchange.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+InternalSyncCompareExchange16 (\r
+  IN      volatile UINT16           *Value,\r
+  IN      UINT16                    CompareValue,\r
+  IN      UINT16                    ExchangeValue\r
+  );\r
+\r
+\r
 /**\r
   Performs an atomic compare exchange operation on a 32-bit unsigned integer.\r
 \r