Changeset 71a0436 in rtems-libbsd


Ignore:
Timestamp:
Oct 24, 2016, 11:29:03 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
afaeccc05a556f6aa25ba044a7e49d6aa634a59e, freebsd-9.3, master
Children:
8090fa0
Parents:
cc8f00d
git-author:
Sebastian Huber <sebastian.huber@…> (10/24/16 11:29:03)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/09/16 09:04:32)
Message:

Add thread fences to <machine/atomic.h>

File:
1 edited

Legend:

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

    rcc8f00d r71a0436  
    14001400}
    14011401
     1402static inline void
     1403atomic_thread_fence_acq(void)
     1404{
     1405
     1406#if defined(_RTEMS_BSD_MACHINE_ATOMIC_USE_ATOMIC)
     1407        std::atomic_thread_fence(std::memory_order_acquire);
     1408#elif defined(_RTEMS_BSD_MACHINE_ATOMIC_USE_STDATOMIC)
     1409        atomic_thread_fence(memory_order_acquire);
     1410#else
     1411        RTEMS_COMPILER_MEMORY_BARRIER();
     1412#endif
     1413}
     1414
     1415static inline void
     1416atomic_thread_fence_rel(void)
     1417{
     1418
     1419#if defined(_RTEMS_BSD_MACHINE_ATOMIC_USE_ATOMIC)
     1420        std::atomic_thread_fence(std::memory_order_release);
     1421#elif defined(_RTEMS_BSD_MACHINE_ATOMIC_USE_STDATOMIC)
     1422        atomic_thread_fence(memory_order_release);
     1423#else
     1424        RTEMS_COMPILER_MEMORY_BARRIER();
     1425#endif
     1426}
     1427
     1428static inline void
     1429atomic_thread_fence_acq_rel(void)
     1430{
     1431
     1432#if defined(_RTEMS_BSD_MACHINE_ATOMIC_USE_ATOMIC)
     1433        std::atomic_thread_fence(std::memory_order_acq_rel);
     1434#elif defined(_RTEMS_BSD_MACHINE_ATOMIC_USE_STDATOMIC)
     1435        atomic_thread_fence(memory_order_acq_rel);
     1436#else
     1437        RTEMS_COMPILER_MEMORY_BARRIER();
     1438#endif
     1439}
     1440
     1441static inline void
     1442atomic_thread_fence_seq_cst(void)
     1443{
     1444
     1445#if defined(_RTEMS_BSD_MACHINE_ATOMIC_USE_ATOMIC)
     1446        std::atomic_thread_fence(std::memory_order_seq_cst);
     1447#elif defined(_RTEMS_BSD_MACHINE_ATOMIC_USE_STDATOMIC)
     1448        atomic_thread_fence(memory_order_seq_cst);
     1449#else
     1450        RTEMS_COMPILER_MEMORY_BARRIER();
     1451#endif
     1452}
     1453
    14021454#endif /* _RTEMS_BSD_MACHINE_ATOMIC_H_ */
Note: See TracChangeset for help on using the changeset viewer.