]>
Commit | Line | Data |
---|---|---|
bba9d162 AP |
1 | #include <Library/DebugLib.h>\r |
2 | #include "InterlockedCompareExchange16.h"\r | |
3 | \r | |
4 | /**\r | |
5 | Performs an atomic compare exchange operation on a 16-bit unsigned integer.\r | |
6 | \r | |
7 | Performs an atomic compare exchange operation on the 16-bit unsigned integer\r | |
8 | specified by Value. If Value is equal to CompareValue, then Value is set to\r | |
9 | ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,\r | |
10 | then Value is returned. The compare exchange operation must be performed using\r | |
11 | MP safe mechanisms.\r | |
12 | \r | |
13 | If Value is NULL, then ASSERT().\r | |
14 | \r | |
15 | @param Value A pointer to the 16-bit value for the compare exchange\r | |
16 | operation.\r | |
17 | @param CompareValue 16-bit value used in compare operation.\r | |
18 | @param ExchangeValue 16-bit value used in exchange operation.\r | |
19 | \r | |
20 | @return The original *Value before exchange.\r | |
21 | \r | |
22 | **/\r | |
23 | UINT16\r | |
24 | EFIAPI\r | |
25 | InterlockedCompareExchange16 (\r | |
26 | IN OUT UINT16 *Value,\r | |
27 | IN UINT16 CompareValue,\r | |
28 | IN UINT16 ExchangeValue\r | |
29 | )\r | |
30 | {\r | |
31 | ASSERT (Value != NULL);\r | |
32 | return InternalSyncCompareExchange16 (Value, CompareValue, ExchangeValue);\r | |
33 | }\r |