Changeset 38f3de6 in rtems-libbsd


Ignore:
Timestamp:
Oct 7, 2021, 8:38:51 PM (2 months ago)
Author:
Kinsey Moore <kinsey.moore@…>
Branches:
6-freebsd-12
Children:
f94a67a
Parents:
0baf1a8
git-author:
Kinsey Moore <kinsey.moore@…> (10/07/21 20:38:51)
git-committer:
Joel Sherrill <joel@…> (10/08/21 14:05:05)
Message:

rtemsbsd/atomic: Return a value for CMPSET

When the cmpset and fcmpset functions were refactored, the return value
of the operation was discarded instead of being returned for SMP builds
outside of gcc 4.x. This had the effect of turning these functions into
a long busywait loop that eventually failed due to integer overflow.

This patch restores the use of the return value of the atomic
operations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rtemsbsd/include/machine/atomic.h

    r0baf1a8 r38f3de6  
    531531#define _ATOMIC_CMPSET(T, p, cmp, set, mo) \
    532532        atomic_##T *q = (atomic_##T *)RTEMS_DEVOLATILE(T *, p); \
    533         atomic_compare_exchange_strong_explicit(q, &cmp, set, \
     533        rv = atomic_compare_exchange_strong_explicit(q, &cmp, set, \
    534534            mo, memory_order_relaxed)
    535535#else
     
    677677#define _ATOMIC_FCMPSET(T, p, cmp, set, mo) \
    678678        atomic_##T *q = (atomic_##T *)RTEMS_DEVOLATILE(T *, p); \
    679         atomic_compare_exchange_strong_explicit(q, cmp, set, \
     679        rv = atomic_compare_exchange_strong_explicit(q, cmp, set, \
    680680           mo, memory_order_relaxed)
    681681#else
Note: See TracChangeset for help on using the changeset viewer.