mirror of
https://github.com/apache/nuttx.git
synced 2025-01-12 22:08:35 +08:00
Merge 5e23c4a79b
into a2d4d74af7
This commit is contained in:
commit
aa6265a7fa
1 changed files with 42 additions and 24 deletions
|
@ -523,19 +523,28 @@ irqstate_t spin_lock_irqsave(FAR volatile spinlock_t *lock)
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SPINLOCK
|
#ifdef CONFIG_SPINLOCK
|
||||||
# define spin_trylock_irqsave_wo_note(l, f) \
|
static inline_function
|
||||||
({ \
|
bool spin_trylock_irqsave_wo_note(FAR volatile spinlock_t *lock,
|
||||||
f = up_irq_save(); \
|
FAR irqstate_t *flags)
|
||||||
spin_trylock_wo_note(l) ? \
|
{
|
||||||
true : ({ up_irq_restore(f); false; }); \
|
*flags = up_irq_save();
|
||||||
})
|
|
||||||
|
if (!spin_trylock_wo_note(lock))
|
||||||
|
{
|
||||||
|
up_irq_restore(*flags);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
# define spin_trylock_irqsave_wo_note(l, f) \
|
static inline_function
|
||||||
({ \
|
bool spin_trylock_irqsave_wo_note(FAR volatile spinlock_t *lock,
|
||||||
(void)(l); \
|
FAR irqstate_t *flags)
|
||||||
f = up_irq_save(); \
|
{
|
||||||
true; \
|
*flags = up_irq_save();
|
||||||
})
|
return true;
|
||||||
|
}
|
||||||
#endif /* CONFIG_SPINLOCK */
|
#endif /* CONFIG_SPINLOCK */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -559,19 +568,28 @@ irqstate_t spin_lock_irqsave(FAR volatile spinlock_t *lock)
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SPINLOCK
|
#ifdef CONFIG_SPINLOCK
|
||||||
# define spin_trylock_irqsave(l, f) \
|
static inline_function
|
||||||
({ \
|
bool spin_trylock_irqsave(FAR volatile spinlock_t *lock,
|
||||||
f = up_irq_save(); \
|
FAR irqstate_t *flags)
|
||||||
spin_trylock(l) ? \
|
{
|
||||||
true : ({ up_irq_restore(f); false; }); \
|
*flags = up_irq_save();
|
||||||
})
|
|
||||||
|
if (!spin_trylock(lock))
|
||||||
|
{
|
||||||
|
up_irq_restore(*flags);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
# define spin_trylock_irqsave(l, f) \
|
static inline_function
|
||||||
({ \
|
bool spin_trylock_irqsave(FAR volatile spinlock_t *lock,
|
||||||
(void)(l); \
|
FAR irqstate_t *flags)
|
||||||
f = up_irq_save(); \
|
{
|
||||||
true; \
|
*flags = up_irq_save();
|
||||||
})
|
return true;
|
||||||
|
}
|
||||||
#endif /* CONFIG_SPINLOCK */
|
#endif /* CONFIG_SPINLOCK */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|
Loading…
Reference in a new issue