Changeset 1871118 in mainline for kernel/generic/include/lib/refcount.h
- Timestamp:
- 2023-02-10T22:59:11Z (2 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 11d2c983
- Parents:
- daadfa6
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2023-02-10 22:53:12)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2023-02-10 22:59:11)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/lib/refcount.h
rdaadfa6 r1871118 76 76 } 77 77 78 /** 79 * Try to upgrade a weak reference. 80 * Naturally, this is contingent on another form of synchronization being used 81 * to ensure that the object continues to exist while the weak reference is in 82 * use. 83 */ 84 static inline bool refcount_try_up(atomic_refcount_t *rc) 85 { 86 int cnt = atomic_load_explicit(&rc->__cnt, memory_order_relaxed); 87 88 while (cnt >= 0) { 89 if (atomic_compare_exchange_weak_explicit(&rc->__cnt, &cnt, cnt + 1, 90 memory_order_relaxed, memory_order_relaxed)) { 91 return true; 92 } 93 } 94 95 return false; 96 } 97 78 98 static inline bool refcount_unique(atomic_refcount_t *rc) 79 99 {
Note:
See TracChangeset
for help on using the changeset viewer.