Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!POSTGRES.BERKELEY.EDU!dillon From: dillon@POSTGRES.BERKELEY.EDU (Matt Dillon) Newsgroups: comp.sys.amiga Subject: Forbid() is not nice / semaphores / locking Message-ID: <8905170309.AA23406@postgres.Berkeley.EDU> Date: 17 May 89 03:09:10 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 23 For anybody interested, the more recent distributions of my sup32.lib and dres.library contain simple, extremely efficient lock and unlock routines: long Lock[2] = { 0,0 }; LockAddr(Lock); UnLockAddr(Lock); 8 locks are available pre Lock structure (two longwords initially 0), where [Un]LockAddr() defaults to bit 0, and two other calls exist to handle the other 7. The routines are extemely fast when the lock can be gained and use the stack to put themselves on an unlock list when the lock cannot be gained (i.e. when they block). One can bind the lock to, say, a global named port structure to name it. The routines are different from semaphores in that they have very little overhead ... 2 longwords and temporary use of a task's stack if they block. These are exclusive locks only. -Matt