MCPcopy Create free account
hub / github.com/apache/nuttx / spin_trylock

Function spin_trylock

include/nuttx/spinlock.h:314–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

312
313#ifdef CONFIG_SPINLOCK
314static inline_function bool spin_trylock(FAR volatile spinlock_t *lock)
315{
316 bool locked;
317
318 /* Notify that we are waiting for a spinlock */
319
320 sched_note_spinlock_lock(lock);
321
322 /* Try lock without trace note */
323
324 locked = spin_trylock_notrace(lock);
325 if (locked)
326 {
327 /* Notify that we have the spinlock */
328
329 sched_note_spinlock_locked(lock);
330 }
331 else
332 {
333 /* Notify that we abort for a spinlock */
334
335 sched_note_spinlock_abort(lock);
336 }
337
338 return locked;
339}
340#endif /* CONFIG_SPINLOCK */
341
342/****************************************************************************

Callers 1

boardctlFunction · 0.85

Calls 4

sched_note_spinlock_lockFunction · 0.85
spin_trylock_notraceFunction · 0.85

Tested by

no test coverage detected