🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #2474

Re: Question about ReleaseSemaphore()

#2474
From: Panzer, John Robert
Date: Sat, 02 Dec 1989 00:36
46 lines
2334 bytes
In article <4955@amiga.UUCP> jimm@batgirl.UUCP (Jim Mackraz) writes:
>In article <3156@hub.UUCP> panzer@cornu.ucsb.edu (Panzer) writes:
>)
>)I'm trying to implement a low-overhead shared (read) lock using
>)signal semaphores, and I've come up with a way that will work
>)if several tasks can effectively share ownership of a semaphore.
>
>We have found a way to implement shared-read/exclusive-write style
>semaphores using the existing semaphore structure, where existing
>callers of ObtainSemaphore magically become "exclusive" in this
>extended scheme.


Great!  So when will 1.4 be out? :^)


>I recommend that you write your own obtainexc/obtainshare/release
>routines around an existing signal semaphore structure that is
>not used by anybody making the Exec calls.


I was hoping that I wouldn't have to move down to signals.  It
seems necessary, though. 


>)What happens if a task ReleaseSemaphore()'s a semaphore which another
>)task had previously ObtainSemaphore()'d? 
>
>For one thing, it's not a semaphore anymore if you deny a task the
>opportunity to decide when it's good and ready to release it.


Well, naturally you'd make sure nobody owned the shared semaphore before
it was released to the system.  (A usecount would work.) 


My manuals are unclear about one point:  When allocating a signal bit, 
can I rely on getting whatever bit I want (within the 16 task-reserved
bits, of course)?  Or do system functions or compiler libraries ever 
use these task bits?   

 
==========================================================================
| John Panzer           | University of California, Santa Barbara        |
| panzer@cornu.ucsb.edu |        School of Computer Violence             |  
==========================================================================
Technical Details
Message-ID: <3196@hub.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!sdsu!ucsd!hub!grape!panzer
References: <3156@hub.UUCP> <4955@amiga.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!sdsu!ucsd!hub!grape!panzer
From: panzer@grape.ucsb.edu (Panzer, John Robert)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Question about ReleaseSemaphore()
Keywords: ReleaseSemaphore
Message-ID: <3196@hub.UUCP>
Date: 2 Dec 89 00:36:19 GMT
References: <3156@hub.UUCP> <4955@amiga.UUCP>
Sender: news@hub.UUCP
Reply-To: panzer@grape.UUCP (Panzer)
Organization: University of California, Santa Barbara
Lines: 46