Skip to content

Commit

Permalink
Common: delete most of the deprecated atomic API
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory38 committed Feb 28, 2016
1 parent 5ca92ec commit 610bf8a
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 61 deletions.
12 changes: 1 addition & 11 deletions common/include/Utilities/Threading.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ namespace Threading

// For use in spin/wait loops.
extern void SpinWait();

// Use prior to committing data to another thread
extern void StoreFence();

Expand All @@ -181,16 +181,6 @@ namespace Threading
extern s32 AtomicRead( volatile s32& Target );
extern u32 AtomicExchange( volatile u32& Target, u32 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.
// Let's not use it. Use mutexes and semaphores instead to create waits. (Air)
Expand Down
25 changes: 0 additions & 25 deletions common/include/intrin_x86.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,6 @@

/*** 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)
{
/* NOTE: __sync_lock_test_and_set would be an acquire barrier, so we force a full barrier */
Expand All @@ -78,21 +68,6 @@ static __inline__ __attribute__((always_inline)) s64 _InterlockedExchange64(vola
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 ***/
static __inline__ __attribute__((always_inline)) void __cpuid(int CPUInfo[], const int InfoType)
{
Expand Down
25 changes: 0 additions & 25 deletions common/src/Utilities/ThreadTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -803,31 +803,6 @@ __fi s32 Threading::AtomicExchange( volatile s32& Target, s32 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
// --------------------------------------------------------------------------------------
Expand Down

0 comments on commit 610bf8a

Please sign in to comment.