🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Semaphores

#13654
From: Michael Sinz - CATS
Date: Mon, 12 Feb 1990 15:58
27 lines
1917 bytes
In article <00253.AA00253@miroc> caw@miroc.UUCP (Christopher A. Wichura) writes:
>I am about to start fooling with semaphores for a program I am working on
>and have run across something that bothers me.  There is no opposite to
>InitSemaphore() that I can find.  When my program wants to exit, which
>includes closing down the semaphore, what do I do?  Is it `safe' to simply
>drop the semaphore if all ObtainSemaphore()s have been matched by an equal
>number of ReleaseSemaphore()s?  This will be a private semaphore so I don't
>have to worry about removing it from the system lists, or at least so it
>would seem.

If the Semaphore is truly PRIVATE then when all users of the semaphore
quit, the semaphore memory can just be FreeMem()ed.  The semaphore contains
only pointers to waiting tasks.  If the semaphore was public, other work
would need to be done.  (Note that this is for SignalSemaphores...)

>
>-=> CAW
>--
>--

/----------------------------------------------------------------------\
|      /// Michael Sinz -- CATS/Amiga Software Engineer                |
|     ///  PHONE 215-431-9422  UUCP ( uunet | rutgers ) !cbmvax!mks    |
|    ///                                                               |
|\\\///          "I don't think so," said Ren'e Descartes.             |
| \XX/                    Just then, he vanished.                      |
\----------------------------------------------------------------------/
Technical Details
Message-ID: <9638@cbmvax.commodore.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!rutgers!cbmvax!mks
References: <00253.AA00253@miroc>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!rutgers!cbmvax!mks
From: mks@cbmvax.commodore.com (Michael Sinz - CATS)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Semaphores
Keywords: Exec Semaphore
Message-ID: <9638@cbmvax.commodore.com>
Date: 12 Feb 90 15:58:39 GMT
References: <00253.AA00253@miroc>
Reply-To: mks@cbmvax.cbm.commodore.com (Michael Sinz - CATS)
Organization: Commodore, West Chester, PA
Lines: 27