1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
5 /*=============================================================
7 ** Source: InterlockedExchangePointer
9 ** Purpose: Positive test the InterlockedExchangePointer API.
10 ** Call InterlockedExchangePointer to exchange a pair of
15 **============================================================*/
18 int __cdecl main(int argc, char *argv[])
27 /*Initialize the PAL environment*/
28 err = PAL_Initialize(argc, argv);
41 pReturnValue = InterlockedExchangePointer((PVOID)&pOldValue,
43 /*check the returned value*/
44 if(*(int *)pReturnValue != i1)
46 Fail("\nFailed to call InterlockedExchangePointer API, "
47 "return pointer does not point to the origional value\n");
50 /*check the exchanged value*/
51 if(*pOldValue != *pNewValue)
53 Fail("\nFailed to call InterlockedExchangePointer API, "
54 "exchanged value is not right\n");