2620 solaris port missing atomics if not using gcc
This commit is contained in:
parent
1c1bac24fd
commit
f2c61cdaa5
5 changed files with 53 additions and 3 deletions
|
@ -28,6 +28,9 @@
|
|||
#include "SDL_mutex.h"
|
||||
#include "SDL_timer.h"
|
||||
|
||||
#if !defined(HAVE_GCC_ATOMICS) && defined(__SOLARIS__)
|
||||
#include <atomic.h>
|
||||
#endif
|
||||
|
||||
/* This function is where all the magic happens... */
|
||||
SDL_bool
|
||||
|
@ -90,6 +93,14 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
|
|||
/* pthread instructions */
|
||||
return (pthread_spin_trylock(lock) == 0);
|
||||
|
||||
#elif defined(__SOLARIS__) && defined(_LP64)
|
||||
/* Used for Solaris with non-gcc compilers. */
|
||||
return (SDL_bool) ((int) atomic_cas_64((volatile uint64_t*)lock, 0, 1) == 0);
|
||||
|
||||
#elif defined(__SOLARIS__) && !defined(_LP64)
|
||||
/* Used for Solaris with non-gcc compilers. */
|
||||
return (SDL_bool) ((int) atomic_cas_32((volatile uint32_t*)lock, 0, 1) == 0);
|
||||
|
||||
#else
|
||||
#error Please implement for your platform.
|
||||
return SDL_FALSE;
|
||||
|
@ -118,6 +129,11 @@ SDL_AtomicUnlock(SDL_SpinLock *lock)
|
|||
#elif HAVE_PTHREAD_SPINLOCK
|
||||
pthread_spin_unlock(lock);
|
||||
|
||||
#elif defined(__SOLARIS__)
|
||||
/* Used for Solaris when not using gcc. */
|
||||
*lock = 0;
|
||||
membar_producer();
|
||||
|
||||
#else
|
||||
*lock = 0;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue