Warn for unused results
This commit is contained in:
parent
1aed6c0715
commit
ee2ddd7e8c
2 changed files with 2 additions and 1 deletions
|
|
@ -4,7 +4,7 @@ void spinlock_init(spinlock_t *l) {
|
|||
l->v = 0;
|
||||
}
|
||||
|
||||
bool spin_trylock(spinlock_t *l) {
|
||||
__attribute__((warn_unused_result)) bool spin_trylock(spinlock_t *l) {
|
||||
uint32_t old;
|
||||
// old = xchg_acquire(&l->v, 1) using AMO
|
||||
__asm__ volatile("amoswap.w.aq %0, %2, (%1)\n" : "=&r"(old) : "r"(&l->v), "r"(1u) : "memory");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue