Do not use atomic_swap_int(9), it is not available on all

architectures.  Atomic_cmpset_int(9) is a direct replacement, due to
loop.  The change fixes arm, arm64, mips an sparc64, which lack
atomic_swap().

Suggested and reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
This commit is contained in:
Konstantin Belousov 2015-07-15 21:44:16 +00:00
parent 57198f08d3
commit 70a3efc14f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=285616

View File

@ -1327,7 +1327,7 @@ ithread_loop(void *arg)
* we are running, it will set it_need to note that we
* should make another pass.
*/
while (atomic_swap_int(&ithd->it_need, 0) != 0) {
while (atomic_cmpset_int(&ithd->it_need, 1, 0) != 0) {
/*
* This needs a release barrier to make sure
* that this write posts before any of the
@ -1506,7 +1506,7 @@ ithread_loop(void *arg)
* we are running, it will set it_need to note that we
* should make another pass.
*/
while (atomic_swap_int(&ithd->it_need, 0) != 0) {
while (atomic_cmpset_int(&ithd->it_need, 1, 0) != 0) {
/*
* This needs a release barrier to make sure
* that this write posts before any of the