🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.mach
Article #918

interrupt and simple_locks

#918
From: Rong Chen
Date: Wed, 03 Apr 1991 18:46
29 lines
1220 bytes
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
Technical Details
Message-ID: <1991Apr3.184610.12580@m.cs.uiuc.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!m.cs.uiuc.edu!rchen

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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