port.h: Make use of compiler support for 64bit atomic ops.
This commit is contained in:
parent
4419edd79c
commit
ae8408f147
|
@ -367,8 +367,6 @@ extern int _spawnvp(int mode, const char *cmdname, const char * const argv[]);
|
||||||
|
|
||||||
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||||
|
|
||||||
extern __int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int64 compare );
|
|
||||||
|
|
||||||
static inline int interlocked_cmpxchg( int *dest, int xchg, int compare )
|
static inline int interlocked_cmpxchg( int *dest, int xchg, int compare )
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -459,7 +457,6 @@ extern int interlocked_xchg( int *dest, int val );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *compare );
|
extern void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *compare );
|
||||||
extern __int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int64 compare );
|
|
||||||
extern void *interlocked_xchg_ptr( void **dest, void *val );
|
extern void *interlocked_xchg_ptr( void **dest, void *val );
|
||||||
#if defined(__x86_64__) || defined(__aarch64__) || defined(_WIN64)
|
#if defined(__x86_64__) || defined(__aarch64__) || defined(_WIN64)
|
||||||
extern unsigned char interlocked_cmpxchg128( __int64 *dest, __int64 xchg_high,
|
extern unsigned char interlocked_cmpxchg128( __int64 *dest, __int64 xchg_high,
|
||||||
|
@ -468,6 +465,15 @@ extern unsigned char interlocked_cmpxchg128( __int64 *dest, __int64 xchg_high,
|
||||||
|
|
||||||
#endif /* __GNUC__ */
|
#endif /* __GNUC__ */
|
||||||
|
|
||||||
|
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
|
||||||
|
static inline __int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int64 compare )
|
||||||
|
{
|
||||||
|
return __sync_val_compare_and_swap( dest, compare, xchg );
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
extern __int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int64 compare );
|
||||||
|
#endif
|
||||||
|
|
||||||
#else /* NO_LIBWINE_PORT */
|
#else /* NO_LIBWINE_PORT */
|
||||||
|
|
||||||
#define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable
|
#define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable
|
||||||
|
|
|
@ -302,6 +302,7 @@ void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *compare )
|
||||||
return compare;
|
return compare;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
|
||||||
__int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int64 compare )
|
__int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int64 compare )
|
||||||
{
|
{
|
||||||
pthread_mutex_lock( &interlocked_mutex );
|
pthread_mutex_lock( &interlocked_mutex );
|
||||||
|
@ -314,6 +315,7 @@ __int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int64 compare )
|
||||||
pthread_mutex_unlock( &interlocked_mutex );
|
pthread_mutex_unlock( &interlocked_mutex );
|
||||||
return compare;
|
return compare;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
|
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
|
||||||
int interlocked_xchg( int *dest, int val )
|
int interlocked_xchg( int *dest, int val )
|
||||||
|
|
Loading…
Reference in New Issue