Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(c) 2015 Intel Corporation 3 : : */ 4 : : 5 : : #ifndef _RTE_RWLOCK_X86_64_H_ 6 : : #define _RTE_RWLOCK_X86_64_H_ 7 : : 8 : : #include "generic/rte_rwlock.h" 9 : : #include "rte_spinlock.h" 10 : : 11 : : #ifdef __cplusplus 12 : : extern "C" { 13 : : #endif 14 : : 15 : : static inline void 16 : 0 : rte_rwlock_read_lock_tm(rte_rwlock_t *rwl) 17 : : __rte_no_thread_safety_analysis 18 : : { 19 [ # # ]: 0 : if (likely(rte_try_tm(&rwl->cnt))) 20 : : return; 21 : 0 : rte_rwlock_read_lock(rwl); 22 : : } 23 : : 24 : : static inline void 25 : : rte_rwlock_read_unlock_tm(rte_rwlock_t *rwl) 26 : : __rte_no_thread_safety_analysis 27 : : { 28 [ # # ]: 0 : if (unlikely(rwl->cnt)) 29 : : rte_rwlock_read_unlock(rwl); 30 : : else 31 : : rte_xend(); 32 : : } 33 : : 34 : : static inline void 35 : 0 : rte_rwlock_write_lock_tm(rte_rwlock_t *rwl) 36 : : __rte_no_thread_safety_analysis 37 : : { 38 [ # # ]: 0 : if (likely(rte_try_tm(&rwl->cnt))) 39 : : return; 40 : 0 : rte_rwlock_write_lock(rwl); 41 : : } 42 : : 43 : : static inline void 44 : : rte_rwlock_write_unlock_tm(rte_rwlock_t *rwl) 45 : : __rte_no_thread_safety_analysis 46 : : { 47 [ # # ]: 0 : if (unlikely(rwl->cnt)) 48 : : rte_rwlock_write_unlock(rwl); 49 : : else 50 : : rte_xend(); 51 : : } 52 : : 53 : : #ifdef __cplusplus 54 : : } 55 : : #endif 56 : : 57 : : #endif /* _RTE_RWLOCK_X86_64_H_ */