mirror of https://github.com/PCSX2/pcsx2.git
Common: delete most of the deprecated atomic API
This commit is contained in:
parent
5ca92ecd67
commit
610bf8a277
|
@ -181,16 +181,6 @@ namespace Threading
|
||||||
extern s32 AtomicRead( volatile s32& Target );
|
extern s32 AtomicRead( volatile s32& Target );
|
||||||
extern u32 AtomicExchange( volatile u32& Target, u32 value );
|
extern u32 AtomicExchange( volatile u32& Target, u32 value );
|
||||||
extern s32 AtomicExchange( volatile s32& Target, s32 value );
|
extern s32 AtomicExchange( volatile s32& Target, s32 value );
|
||||||
extern u32 AtomicExchangeAdd( volatile u32& Target, u32 value );
|
|
||||||
extern s32 AtomicExchangeAdd( volatile s32& Target, s32 value );
|
|
||||||
extern s32 AtomicExchangeSub( volatile s32& Target, s32 value );
|
|
||||||
extern u32 AtomicIncrement( volatile u32& Target );
|
|
||||||
extern s32 AtomicIncrement( volatile s32& Target );
|
|
||||||
extern u32 AtomicDecrement( volatile u32& Target );
|
|
||||||
extern s32 AtomicDecrement( volatile s32& Target );
|
|
||||||
|
|
||||||
extern bool AtomicBitTestAndReset( volatile u32& bitset, u8 bit );
|
|
||||||
extern bool AtomicBitTestAndReset( volatile s32& bitset, u8 bit );
|
|
||||||
|
|
||||||
// pthread Cond is an evil api that is not suited for Pcsx2 needs.
|
// pthread Cond is an evil api that is not suited for Pcsx2 needs.
|
||||||
// Let's not use it. Use mutexes and semaphores instead to create waits. (Air)
|
// Let's not use it. Use mutexes and semaphores instead to create waits. (Air)
|
||||||
|
|
|
@ -54,16 +54,6 @@
|
||||||
|
|
||||||
/*** Atomic operations ***/
|
/*** Atomic operations ***/
|
||||||
|
|
||||||
static __inline__ __attribute__((always_inline)) s32 _InterlockedCompareExchange(volatile s32 * const Destination, const s32 Exchange, const s32 Comperand)
|
|
||||||
{
|
|
||||||
return __sync_val_compare_and_swap(Destination, Comperand, Exchange);
|
|
||||||
}
|
|
||||||
|
|
||||||
static __inline__ __attribute__((always_inline)) s64 _InterlockedCompareExchange64(volatile s64 * const Destination, const s64 Exchange, const s64 Comperand)
|
|
||||||
{
|
|
||||||
return __sync_val_compare_and_swap(Destination, Comperand, Exchange);
|
|
||||||
}
|
|
||||||
|
|
||||||
static __inline__ __attribute__((always_inline)) s32 _InterlockedExchange(volatile s32 * const Target, const s32 Value)
|
static __inline__ __attribute__((always_inline)) s32 _InterlockedExchange(volatile s32 * const Target, const s32 Value)
|
||||||
{
|
{
|
||||||
/* NOTE: __sync_lock_test_and_set would be an acquire barrier, so we force a full barrier */
|
/* NOTE: __sync_lock_test_and_set would be an acquire barrier, so we force a full barrier */
|
||||||
|
@ -78,21 +68,6 @@ static __inline__ __attribute__((always_inline)) s64 _InterlockedExchange64(vola
|
||||||
return __sync_lock_test_and_set(Target, Value);
|
return __sync_lock_test_and_set(Target, Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline__ __attribute__((always_inline)) s32 _InterlockedExchangeAdd(volatile s32 * const Addend, const s32 Value)
|
|
||||||
{
|
|
||||||
return __sync_fetch_and_add(Addend, Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static __inline__ __attribute__((always_inline)) s32 _InterlockedDecrement(volatile s32 * const lpAddend)
|
|
||||||
{
|
|
||||||
return _InterlockedExchangeAdd(lpAddend, -1) - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static __inline__ __attribute__((always_inline)) s32 _InterlockedIncrement(volatile s32 * const lpAddend)
|
|
||||||
{
|
|
||||||
return _InterlockedExchangeAdd(lpAddend, 1) + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** System information ***/
|
/*** System information ***/
|
||||||
static __inline__ __attribute__((always_inline)) void __cpuid(int CPUInfo[], const int InfoType)
|
static __inline__ __attribute__((always_inline)) void __cpuid(int CPUInfo[], const int InfoType)
|
||||||
{
|
{
|
||||||
|
|
|
@ -803,31 +803,6 @@ __fi s32 Threading::AtomicExchange( volatile s32& Target, s32 value ) {
|
||||||
return _InterlockedExchange( (volatile vol_t*)&Target, value );
|
return _InterlockedExchange( (volatile vol_t*)&Target, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
__fi u32 Threading::AtomicExchangeAdd( volatile u32& Target, u32 value ) {
|
|
||||||
return _InterlockedExchangeAdd( (volatile vol_t*)&Target, value );
|
|
||||||
}
|
|
||||||
__fi s32 Threading::AtomicExchangeAdd( volatile s32& Target, s32 value ) {
|
|
||||||
return _InterlockedExchangeAdd( (volatile vol_t*)&Target, value );
|
|
||||||
}
|
|
||||||
|
|
||||||
__fi s32 Threading::AtomicExchangeSub( volatile s32& Target, s32 value ) {
|
|
||||||
return _InterlockedExchangeAdd( (volatile vol_t*)&Target, -value );
|
|
||||||
}
|
|
||||||
|
|
||||||
__fi u32 Threading::AtomicIncrement( volatile u32& Target ) {
|
|
||||||
return _InterlockedExchangeAdd( (volatile vol_t*)&Target, 1 );
|
|
||||||
}
|
|
||||||
__fi s32 Threading::AtomicIncrement( volatile s32& Target) {
|
|
||||||
return _InterlockedExchangeAdd( (volatile vol_t*)&Target, 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
__fi u32 Threading::AtomicDecrement( volatile u32& Target ) {
|
|
||||||
return _InterlockedExchangeAdd( (volatile vol_t*)&Target, -1 );
|
|
||||||
}
|
|
||||||
__fi s32 Threading::AtomicDecrement(volatile s32& Target) {
|
|
||||||
return _InterlockedExchangeAdd((volatile vol_t*)&Target, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
// BaseThreadError
|
// BaseThreadError
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue