Why is “sleeping” not allowed while holding a spinlock? [duplicate]
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Why can't you sleep while holding spinlock? As far as I know, spinlocks should be used in short duration, and are only choices in code such as interrupt handler where sleeping (preemption) is not allowed. However, I do not know why there is such a "rule" that there SHOULD BE no sleeping at all while holding a spinlock. I know that it is not a recommended practice (since it is detrimental in performance), but I