Added InterlockedCompareExchangePointer macro and 64 bit versions for Interlocked[Compare]ExchangePointer macros for use in ntoskrnl.

svn path=/trunk/; revision=11915
This commit is contained in:
Gregor Anich 2004-12-04 16:56:20 +00:00
parent 666228254c
commit 7acc56f32e
2 changed files with 20 additions and 10 deletions

View file

@ -991,8 +991,23 @@ InterlockedIncrement (
);
#ifndef InterlockedExchangePointer
#define InterlockedExchangePointer(__T__, __V__) \
(PVOID)InterlockedExchange((PLONG)(__T__), (LONG)(__V__))
# ifdef _WIN64
# define InterlockedExchangePointer(__T__, __V__) \
(PVOID)InterlockedExchange64((PLONGLONG)(__T__), (LONGLONG)(__V__))
# else
# define InterlockedExchangePointer(__T__, __V__) \
(PVOID)InterlockedExchange((PLONG)(__T__), (LONG)(__V__))
# endif
#endif
#ifndef InterlockedCompareExchangePointer
# ifdef _WIN64
# define InterlockedCompareExchangePointer(__T__, __V__, __C__) \
(PVOID)InterlockedCompareExchange64((PLONGLONG)(__T__), (LONGLONG)(__V__), (LONGLONG)(__C__))
# else
# define InterlockedCompareExchangePointer(__T__, __V__, __C__) \
(PVOID)InterlockedCompareExchange((PLONG)(__T__), (LONG)(__V__), (LONG)(__C__))
# endif
#endif
/*---*/

View file

@ -1,4 +1,4 @@
/* $Id: kill.c,v 1.88 2004/12/04 15:49:20 blight Exp $
/* $Id: kill.c,v 1.89 2004/12/04 16:56:20 blight Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -142,13 +142,8 @@ PsTerminateCurrentThread(NTSTATUS ExitStatus)
/* If the ProcessoR Control Block's NpxThread points to the current thread
* unset it.
*/
#ifdef _WIN64
InterlockedCompareExchange64((LONGLONG *)&KeGetCurrentKPCR()->PrcbData.NpxThread,
(LONGLONG)NULL, (LONGLONG)ETHREAD_TO_KTHREAD(CurrentThread));
#else
InterlockedCompareExchange((LONG *)&KeGetCurrentKPCR()->PrcbData.NpxThread,
(LONG)NULL, (LONG)ETHREAD_TO_KTHREAD(CurrentThread));
#endif
InterlockedCompareExchangePointer(&KeGetCurrentKPCR()->PrcbData.NpxThread,
NULL, ETHREAD_TO_KTHREAD(CurrentThread));
KeReleaseSpinLock(&PiThreadLock, oldIrql);