Skip to content

Commit

Permalink
spinlock: Add spin_lock_init macro like Linux
Browse files Browse the repository at this point in the history
Signed-off-by: Xiang Xiao <[email protected]>
  • Loading branch information
xiaoxiang781216 authored and acassis committed Oct 7, 2023
1 parent dfa0283 commit c775ee1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions include/nuttx/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,24 @@ static inline spinlock_t up_testset(FAR volatile spinlock_t *lock)
}
#endif

/****************************************************************************
* Name: spin_lock_init
*
* Description:
* Initialize a non-reentrant spinlock object to its initial,
* unlocked state.
*
* Input Parameters:
* lock - A reference to the spinlock object to be initialized.
*
* Returned Value:
* None.
*
****************************************************************************/

/* void spin_lock_init(FAR spinlock_t *lock); */
#define spin_lock_init(l) do { *(l) = SP_UNLOCKED; } while (0)

/****************************************************************************
* Name: spin_lock
*
Expand Down

0 comments on commit c775ee1

Please sign in to comment.