More protection around the atomic operations on Windows. Still ahve to find
a way to detect them correctly without popping up a Windows error message box. This commit was SVN r8586.
Этот коммит содержится в:
родитель
b6036d985b
Коммит
b88f2a3c32
@ -63,8 +63,13 @@ static inline void opal_atomic_wmb(void)
|
||||
static inline int opal_atomic_cmpset_acq_32( volatile int32_t *addr,
|
||||
int32_t oldval, int32_t newval)
|
||||
{
|
||||
int32_t ret = InterlockedCompareExchangeAcquire ((long volatile*) addr,
|
||||
(long) newval, (long) oldval);
|
||||
#if HAVE_INTERLOCKEDCOMPAREEXCHANGEACQUIRE
|
||||
int32_t ret = InterlockedCompareExchangeAcquire( (long volatile*)addr,
|
||||
(long)newval, (long)oldval);
|
||||
#else
|
||||
int32_t ret = InterlockedCompareExchange( (long volatile*)addr,
|
||||
(long)newval, (long)oldval );
|
||||
#endif /* HAVE_INTERLOCKEDCOMPAREEXCHANGEACQUIRE */
|
||||
return (oldval == ret) ? 1: 0;
|
||||
}
|
||||
|
||||
@ -72,8 +77,13 @@ static inline int opal_atomic_cmpset_acq_32( volatile int32_t *addr,
|
||||
static inline int opal_atomic_cmpset_rel_32( volatile int32_t *addr,
|
||||
int32_t oldval, int32_t newval)
|
||||
{
|
||||
int32_t ret = InterlockedCompareExchangeRelease ((long volatile*) addr,
|
||||
(long) newval, (long) oldval);
|
||||
#if HAVE_INTERLOCKEDCOMPAREEXCHANGERELEASE
|
||||
int32_t ret = InterlockedCompareExchangeRelease( (long volatile*)addr,
|
||||
(long)newval, (long)oldval );
|
||||
#else
|
||||
int32_t ret = InterlockedCompareExchange( (long volatile*)addr,
|
||||
(long)newval, (long)oldval );
|
||||
#endif /* HAVE_INTERLOCKEDCOMPAREEXCHANGERELEASE */
|
||||
return (oldval == ret) ? 1: 0;
|
||||
}
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user