🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Amiga semaphores (HELP!)

#5315
From: John J. Szucs
Date: Mon, 17 Sep 1990 17:40
50 lines
2238 bytes
In article <2290004@hp-ptp.HP.COM> jimg@hp-ptp.HP.COM (Jim_Garrison) writes:
>
>Hello,
>
>I've trying to use Amiga Semaphores, as a mechanism to let only one program
>access a particular resource at a time.  I'm using the Amiga Programmers
>Reference by Eugene Mortimer, as a reference for using the semaphores.  I
>seem to recall that there is either some problem with the description of
>semaphores in this book, or there are problems with the way Amiga semaphores
>work.  I'm using an A2500 with Amigados 1.3 and Lattice 5.05 C compiler.
>
[stuff deleted]
>
>Thanks in advance,
>
>
>Jim Garrison (jimg@hpiatmh)
>Hewlett Packard
>Industrial Applications Center
>(408) 746-5349
[code deleted]

Under Kickstart/Workbench Release 1.3, the exec.library/AddSemaphore function
does not work properly.

Use the following:

void LocalAddSemaphore(struct SignalSemaphore *SignalSemaphore)
{
	SignalSemaphore-.ss_Link.ln_Type=NT_SIGNALSEM;
	InitSemaphore(SignalSemaphore);
	Forbid();
	Enqueue(&SysBase->SemaphoreList,SignalSemaphore);
	Permit();
}

This is documented in the AutoDocs (available from CATS).

The function is correct under Kickstart/Workbench Release 2.0.

================================================================================
|| John J. Szucs                    || The opinions expressed are my own and  ||
|| Systems Evaluation Group         || in no way represent the opinions or    ||
|| Product Assurance Department     || policies of Commodore Technology, Inc. ||
|| Commodore Technology, Inc.       || or any associated entity.              ||
================================================================================
...{rutgers|uunet|pyramid}!cbmvax!jjszucs
jjszucs@cbmvax.commodore.com

"Everything is deeply intertwingled." - Ted Nelson, Computer Lib/Dream Machines
Technical Details
Message-ID: <14485@cbmvax.commodore.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cbmvax!jjszucs
References: <2290004@hp-ptp.HP.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cbmvax!jjszucs
From: jjszucs@cbmvax.commodore.com (John J. Szucs)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Amiga semaphores (HELP!)
Message-ID: <14485@cbmvax.commodore.com>
Date: 17 Sep 90 17:40:41 GMT
References: <2290004@hp-ptp.HP.COM>
Reply-To: jjszucs@cbmvax.commodore.com (John J. Szucs)
Organization: Commodore, West Chester, PA
Lines: 50