Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!m.cs.uiuc.edu!rchen From: rchen@m.cs.uiuc.edu (Rong Chen) Newsgroups: comp.os.mach Subject: interrupt and simple_locks Message-ID: <1991Apr3.184610.12580@m.cs.uiuc.edu> Date: 3 Apr 91 18:46:10 GMT Distribution: comp Organization: University of Illinois, Dept. of Comp. Sci., Urbana, IL Lines: 28 While I was reading the source code of Mach3.0, I noticed that the hardware interrupts, if any, are always turned off before a simple-lock is applied to a Mach object. For example: s = splsched(); simple_lock(&timer_lock); ... simple_unlock(&timer_lock); splx(s); What's the reason for it? Shouldn't we do it the other way round? Like: simple_lock(&timer_lock); s = splsched(); ... splx(s); simple_lock(&timer_lock); Since simple-locks are spin locks, they may prolong the period of disabling interrupts unnecessarily, in my humble opinion. It is true that an interrupt may arrive after an object has been locked, but that should not cause any harm, right? Thanks for anyone who could enlighten me on this issue. -Rong Chen Department of Computer Science University of Illinois at Urbana-Champaign