This macro is used to define the input parameter lock as a spinlock, and initialize the spinlock statically.
This macro has no return value.
Note that the input parameter lock does not need to be defined before calling this macro. Otherwise, the variable lock is repeatedly defined.
On Non-SMP (UP) mode, this macro has no effect.
The spinlock is advised to protect operation that take a short time. Otherwise, the overall system performance may be affected because the thread exits the waiting loop only after the spinlock is obtained. For time-consuming operation, the mutex lock can be used instead of spinlock.
由 William Goodspeed 维护 | E-mail: gongzl@stu.hebust.edu.cn | Wechat: a23333344 | ALSO CHECKOUT WS63FLASH!