SpinLock read_lock_irqsave 标志属性
这是关于 void spin_lock_irqsave(spinlock_t *lock, unsigned long flags); 函数调用。前面提到,之前的中断状态存储在标志中,我们可以通过将其传递给 spin_unlock_irqrestore 函数来恢复它们。
但我不明白当调用 spin_lock_irqsave
时,由值传递的标志如何捕获先前的中断状态。
This is regarding the void spin_lock_irqsave(spinlock_t *lock, unsigned long flags);
function call. It is mentioned that previous interrupt state is stored in flags and we can restore them by passing this to spin_unlock_irqrestore
function.
But I did not get how flags which is passed by values captures the previous interrupt state when spin_lock_irqsave
is called.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
spin_lock_irqsave
是一个宏,而不是一个函数。因此它可以分配给flags
,即使它显然是按值传递的。请参阅:
http://lxr.linux。否/#linux+v2.6.35.4/include/linux/spinlock.h#L312
http://lxr.linux.no/ #linux+v2.6.35.4/include/linux/spinlock.h#L187
spin_lock_irqsave
is a macro, not a function. So it can assign toflags
even though it's apparently passed by value.See:
http://lxr.linux.no/#linux+v2.6.35.4/include/linux/spinlock.h#L312
http://lxr.linux.no/#linux+v2.6.35.4/include/linux/spinlock.h#L187