Merge port of Google SMP patch to Solaris

This commit is contained in:
Mikael Ronstrom 2008-10-30 10:23:36 +01:00
commit 090bcb74ab
14 changed files with 78 additions and 51 deletions

View file

@ -88,8 +88,9 @@ mutex_test_and_set(
/* mutex_fence(); */
return(res);
#elif defined(HAVE_GCC_ATOMIC_BUILTINS)
return __sync_lock_test_and_set(&(mutex->lock_word), 1);
#elif defined(MY_ATOMIC_NOLOCK)
return ((byte)my_atomic_swap8(
(int8 volatile *)&(mutex->lock_word), 1));
#else
ibool ret;
@ -126,11 +127,11 @@ mutex_reset_lock_word(
__asm MOV EDX, 0
__asm MOV ECX, lw
__asm XCHG DL, BYTE PTR [ECX]
#elif defined(HAVE_GCC_ATOMIC_BUILTINS)
#elif defined(MY_ATOMIC_NOLOCK)
/* In theory __sync_lock_release should be used to release the lock.
Unfortunately, it does not work properly alone. The workaround is
that more conservative __sync_lock_test_and_set is used instead. */
__sync_lock_test_and_set(&(mutex->lock_word), 0);
(void)my_atomic_swap8((int8 volatile *)&(mutex->lock_word), 0);
#else
mutex->lock_word = 0;