2 * PROJECT: ReactOS system libraries
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: lib/intrlck/i386/compareexchange.c
5 * PURPOSE: Inter lock compare exchanges
6 * PROGRAMMERS: Copyright 1995 Martin von Loewis
7 * Copyright 1997 Onno Hovers
10 /************************************************************************
11 * InterlockedCompareExchange
13 * Atomically compares Destination and Comperand, and if found equal exchanges
14 * the value of Destination with Exchange
17 * Prior value of value pointed to by Destination
21 * LONG NTAPI InterlockedCompareExchange(LPLONG Destination, LONG Exchange, LONG Comperand)
27 InterlockedCompareExchange(
28 IN OUT LONG
volatile *Destination
,
34 "lock; cmpxchgl %2,(%1)"
35 : "=a" (ret
) : "r" (Destination
), "r" (Exchange
), "0" (Comperand
) : "memory" );