From 94b80cf49f918d7eb345e8899beff3dd36fd4c90 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 26 Mar 2014 16:09:48 +0000 Subject: [PATCH] Intrin.h: Implement _InterlockedExchangePointer git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204827 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Headers/Intrin.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Headers/Intrin.h b/lib/Headers/Intrin.h index 2ed88301cf..90a218e629 100644 --- a/lib/Headers/Intrin.h +++ b/lib/Headers/Intrin.h @@ -422,6 +422,7 @@ static __inline__ __int64 _InterlockedExchange64(__int64 volatile *_Target, __int64 _Value); static __inline__ __int64 _InterlockedExchangeAdd64(__int64 volatile *_Addend, __int64 _Value); +static __inline__ void *_InterlockedExchangePointer(void *volatile *_Target, void *_Value); static __inline__ __int64 _InterlockedIncrement64(__int64 volatile *_Addend); @@ -795,6 +796,11 @@ _InterlockedExchange64(__int64 volatile *_Target, __int64 _Value) { __atomic_exchange(_Target, &_Value, &_Value, 0); return _Value; } +static __inline__ void *__attribute__((__always_inline__, __nodebug__)) +_InterlockedExchangePointer(void *volatile *_Target, void *_Value) { + __atomic_exchange(_Target, &_Value, &_Value, 0); + return _Value; +} #endif /*----------------------------------------------------------------------------*\ |* Interlocked Compare Exchange -- 2.40.0